Data related to Section S2B
Quality Control Scoring and Processing
We load relevant rating data
Calcuate means and medians
library(corrplot); library(reshape2)
## corrplot 0.84 loaded
ratings<-read.csv("averaged_RU_ratings.csv")
vars<-c("sub_ID","Rater1","Rater2","Rater3","Rater4","Rater5","Rater6")
only_ratings<-ratings[vars]
only_ratings_long<-melt(only_ratings, id.vars=c("sub_ID"))
mean(only_ratings_long$value,na.rm = TRUE)
## [1] 6.145644
median(only_ratings_long$value,na.rm = TRUE)
## [1] 6
Density plot of ratings
Figure S2A (left panel)
library(ggplot2)
ggplot(data=only_ratings_long, aes(x=value, group=variable, fill=variable)) + geom_density(adjust=1.5, alpha=.4)
## Warning: Removed 21 rows containing non-finite values (stat_density).
Corrplot of correlations between raters
Figure S2B (right panel)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
only_ratings_noID<-only_ratings%>% dplyr::select(-sub_ID)
M<-cor(only_ratings_noID,use = "na.or.complete")
corrplot.mixed(M,is.corr=FALSE,cl.lim = c(.6,1),lower.col = "black", number.cex = 1.2)
Calculation of ICCs between raters
and rating distribution graphs
and construction of Figure S3
library(irr)
## Loading required package: lpSolve
icc(only_ratings_noID, model = "twoway", type = "agreement", unit = "single")
## Single Score Intraclass Correlation
##
## Model: twoway
## Type : agreement
##
## Subjects = 367
## Raters = 6
## ICC(A,1) = 0.819
##
## F-Test, H0: r0 = 0 ; H1: r0 > 0
## F(366,220) = 32.7 , p = 2.42e-111
##
## 95%-Confidence Interval for ICC Population Values:
## 0.779 < ICC < 0.851
icc(only_ratings_noID, model = "twoway", type = "consistency", unit = "average")
## Average Score Intraclass Correlation
##
## Model: twoway
## Type : consistency
##
## Subjects = 367
## Raters = 6
## ICC(C,6) = 0.969
##
## F-Test, H0: r0 = 0 ; H1: r0 > 0
## F(366,1830) = 32.7 , p = 0
##
## 95%-Confidence Interval for ICC Population Values:
## 0.964 < ICC < 0.974
qplot(ratings$averages,geom="histogram",fill=I("white"), col=I("black"), alpha=I(.6)) + geom_vline(xintercept = 6, linetype="dashed", color = "red", size=1.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Worked related to Section
S3. Analyses Examining Passing Visual Inspect, with CAT12 and Euler Number
Also construction of Figure S4
Of note: 21 subjects didn’t complete Freesurfer, but did complete CAT12
combined<-read.csv("HBN_combined_2021_03_04_full.csv")
combined<-subset(combined,combined$CAT12_QC_Weighted_Average!="NA")
cor.test(combined$CAT12_QC_Weighted_Average,combined$SurfaceHoles)
##
## Pearson's product-moment correlation
##
## data: combined$CAT12_QC_Weighted_Average and combined$SurfaceHoles
## t = -40.128, df = 361, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.9210526 -0.8830223
## sample estimates:
## cor
## -0.9038064
ggplot(combined, aes(y=CAT12_QC_Weighted_Average, x=SurfaceHoles)) +geom_point(shape=16, size=5,alpha = 0.5,show.legend = FALSE) + geom_smooth(method=lm, color = 'red')
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 24 rows containing non-finite values (stat_smooth).
## Warning: Removed 24 rows containing missing values (geom_point).
summary(glm(passing ~ SurfaceHoles, data=combined, family=binomial(link="logit")))
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## Call:
## glm(formula = passing ~ SurfaceHoles, family = binomial(link = "logit"),
## data = combined)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.29163 -0.01636 0.14066 0.26834 2.80179
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.190567 0.684999 9.037 <2e-16 ***
## SurfaceHoles -0.068678 0.008199 -8.376 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 495.46 on 362 degrees of freedom
## Residual deviance: 126.17 on 361 degrees of freedom
## (24 observations deleted due to missingness)
## AIC: 130.17
##
## Number of Fisher Scoring iterations: 8
summary(glm(passing ~ SurfaceHoles + CAT12_QC_Weighted_Average, data=combined, family=binomial(link="logit")))
##
## Call:
## glm(formula = passing ~ SurfaceHoles + CAT12_QC_Weighted_Average,
## family = binomial(link = "logit"), data = combined)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.60135 -0.01495 0.06462 0.11984 2.07656
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -74.006218 15.758786 -4.696 2.65e-06 ***
## SurfaceHoles -0.025629 0.009806 -2.614 0.00896 **
## CAT12_QC_Weighted_Average 90.418203 18.165415 4.977 6.44e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 495.459 on 362 degrees of freedom
## Residual deviance: 91.052 on 360 degrees of freedom
## (24 observations deleted due to missingness)
## AIC: 97.052
##
## Number of Fisher Scoring iterations: 8
Construction of Figure S5
ROC Curves
library(pROC)
## Type 'citation("pROC")' for a citation.
##
## Attaching package: 'pROC'
## The following objects are masked from 'package:stats':
##
## cov, smooth, var
combined_both_euler_cat12<-subset(combined,combined$CAT12_QC_Weighted_Average!="NA" & combined$SurfaceHoles!="NA")
summary(model_CAT12_pass<-glm(passing~ CAT12_QC_Weighted_Average , family = "binomial", data=combined_both_euler_cat12))
##
## Call:
## glm(formula = passing ~ CAT12_QC_Weighted_Average, family = "binomial",
## data = combined_both_euler_cat12)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.59703 -0.04076 0.06434 0.11780 2.33913
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -100.71 13.34 -7.550 4.35e-14 ***
## CAT12_QC_Weighted_Average 119.41 15.76 7.575 3.60e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 495.459 on 362 degrees of freedom
## Residual deviance: 98.824 on 361 degrees of freedom
## AIC: 102.82
##
## Number of Fisher Scoring iterations: 8
summary(model_w_Euler<-glm(passing~ SurfaceHoles , family = "binomial", data=combined_both_euler_cat12))
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
##
## Call:
## glm(formula = passing ~ SurfaceHoles, family = "binomial", data = combined_both_euler_cat12)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.29163 -0.01636 0.14066 0.26834 2.80179
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.190567 0.684999 9.037 <2e-16 ***
## SurfaceHoles -0.068678 0.008199 -8.376 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 495.46 on 362 degrees of freedom
## Residual deviance: 126.17 on 361 degrees of freedom
## AIC: 130.17
##
## Number of Fisher Scoring iterations: 8
summary(model_CAT12_pass_w_Euler<-glm(passing~ CAT12_QC_Weighted_Average +SurfaceHoles , family = "binomial", data=combined_both_euler_cat12))
##
## Call:
## glm(formula = passing ~ CAT12_QC_Weighted_Average + SurfaceHoles,
## family = "binomial", data = combined_both_euler_cat12)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.60135 -0.01495 0.06462 0.11984 2.07656
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -74.006218 15.758786 -4.696 2.65e-06 ***
## CAT12_QC_Weighted_Average 90.418203 18.165415 4.977 6.44e-07 ***
## SurfaceHoles -0.025629 0.009806 -2.614 0.00896 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 495.459 on 362 degrees of freedom
## Residual deviance: 91.052 on 360 degrees of freedom
## AIC: 97.052
##
## Number of Fisher Scoring iterations: 8
preds1=predict(model_w_Euler)
roc1=roc(combined_both_euler_cat12$passing ~ preds1)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
preds2=predict(model_CAT12_pass)
roc2=roc(combined_both_euler_cat12$passing ~ preds2)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
preds3=predict(model_CAT12_pass_w_Euler)
roc3=roc(combined_both_euler_cat12$passing ~ preds3)
## Setting levels: control = 0, case = 1
## Setting direction: controls < cases
plot(roc1)
plot(roc2, add=TRUE, col='red')
plot(roc3, add=TRUE, col='blue')
# just Euler
roc1$auc
## Area under the curve: 0.9837
# just CAT12
roc2$auc
## Area under the curve: 0.9888
# both Euler and CAT12
roc3$auc
## Area under the curve: 0.9905
Work related to: S4. Association Between CAT12 Scan Rating and Freesurfer Outputs, Controlling for Participant Age Similar code to the main manuscript
Major exception is that the regression loops
Also include AGE as an independent variable
combined<-read.csv("HBN_combined_2021_03_04_full.csv")
combined<-subset(combined,combined$CAT12_QC_Weighted_Average!="NA")
OnlySubsPassingVisualQC<-subset(combined,combined$passing==1)
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC[,14:58]
OnlySubsPassingVisualQC_Freesurfer_AREA<-OnlySubsPassingVisualQC[,78:147]
OnlySubsPassingVisualQC_Freesurfer_AREA<-OnlySubsPassingVisualQC_Freesurfer_AREA %>% dplyr::select(-c(lh_WhiteSurfArea_area,eTIV))
OnlySubsPassingVisualQC_Freesurfer_AREA$CAT12_QC_Weighted_Average<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Age<-OnlySubsPassingVisualQC$Basic_Demos.Age
n<-68
AREA_for_Figure<-OnlySubsPassingVisualQC_Freesurfer_AREA[,1:68]
CAT12Ratings<-OnlySubsPassingVisualQC_Freesurfer_AREA[,69]
#Regression Loops
### Here is the major difference
# the regression models include two independent variables
AREA_Loop_to_Extract_Tstats_w_Age <- lapply(1:n, function(x) lm(AREA_for_Figure[,x] ~ Age + CAT12Ratings))
#Pulling out t-statistics, etc.
AREA_summaries_w_Age <- lapply(AREA_Loop_to_Extract_Tstats_w_Age, summary)
AREA_saved_T_w_Age<-lapply(AREA_summaries_w_Age, function(x) x$coefficients[, c(3)])
AREA_T_Statistics_temp_w_Age<-lapply(AREA_saved_T_w_Age, function (x) x[c('CAT12Ratings')])
AREA_just_T_Statistics_w_Age<-do.call(rbind.data.frame, AREA_T_Statistics_temp_w_Age)
names(AREA_just_T_Statistics_w_Age)[names(AREA_just_T_Statistics_w_Age)=="c.0.579815399018395..1.90188075224604..1.02918104971098...0.211054192370857.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
AREA_just_T_Statistics_w_Age$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_T_Statistics_w_Age<-AREA_just_T_Statistics_w_Age[, c(2,1)]
## Pull out P-Values from Regressions
AREA_saved_p_w_Age<-lapply(AREA_summaries_w_Age, function(x) x$coefficients[, c(4)])
AREA_p_Statistics_temp_w_Age<-lapply(AREA_saved_p_w_Age, function (x) x[c('CAT12Ratings')])
AREA_just_p_Statistics_w_Age<-do.call(rbind.data.frame, AREA_p_Statistics_temp_w_Age)
names(AREA_just_p_Statistics_w_Age)[names(AREA_just_p_Statistics_w_Age)=="c.0.562675798522239..0.0585888381420907..0.304607362851488..0.83305463630783.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
AREA_just_p_Statistics_w_Age$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_p_Statistics_w_Age<-AREA_just_p_Statistics_w_Age[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse);library(stats);library(gt);library(cowplot);library(dplyr)
## ── Attaching packages ────────────────────────────────── tidyverse 1.3.0.9000 ──
## ✓ tibble 3.0.6 ✓ purrr 0.3.4
## ✓ tidyr 1.1.2 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
dk_statistical_values_AREA_T_w_Age= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(AREA_just_T_Statistics_w_Age$T_stat[1],
AREA_just_T_Statistics_w_Age$T_stat[2],
AREA_just_T_Statistics_w_Age$T_stat[3],
AREA_just_T_Statistics_w_Age$T_stat[4],
AREA_just_T_Statistics_w_Age$T_stat[5],
AREA_just_T_Statistics_w_Age$T_stat[6],
AREA_just_T_Statistics_w_Age$T_stat[7],
AREA_just_T_Statistics_w_Age$T_stat[8],
AREA_just_T_Statistics_w_Age$T_stat[9],
AREA_just_T_Statistics_w_Age$T_stat[10],
AREA_just_T_Statistics_w_Age$T_stat[11],
AREA_just_T_Statistics_w_Age$T_stat[12],
AREA_just_T_Statistics_w_Age$T_stat[13],
AREA_just_T_Statistics_w_Age$T_stat[14],
AREA_just_T_Statistics_w_Age$T_stat[15],
AREA_just_T_Statistics_w_Age$T_stat[16],
AREA_just_T_Statistics_w_Age$T_stat[17],
AREA_just_T_Statistics_w_Age$T_stat[18],
AREA_just_T_Statistics_w_Age$T_stat[19],
AREA_just_T_Statistics_w_Age$T_stat[20],
AREA_just_T_Statistics_w_Age$T_stat[21],
AREA_just_T_Statistics_w_Age$T_stat[22],
AREA_just_T_Statistics_w_Age$T_stat[23],
AREA_just_T_Statistics_w_Age$T_stat[24],
AREA_just_T_Statistics_w_Age$T_stat[25],
AREA_just_T_Statistics_w_Age$T_stat[26],
AREA_just_T_Statistics_w_Age$T_stat[27],
AREA_just_T_Statistics_w_Age$T_stat[28],
AREA_just_T_Statistics_w_Age$T_stat[29],
AREA_just_T_Statistics_w_Age$T_stat[30],
AREA_just_T_Statistics_w_Age$T_stat[31],
AREA_just_T_Statistics_w_Age$T_stat[32],
AREA_just_T_Statistics_w_Age$T_stat[33],
AREA_just_T_Statistics_w_Age$T_stat[34],
AREA_just_T_Statistics_w_Age$T_stat[35],
AREA_just_T_Statistics_w_Age$T_stat[36],
AREA_just_T_Statistics_w_Age$T_stat[37],
AREA_just_T_Statistics_w_Age$T_stat[38],
AREA_just_T_Statistics_w_Age$T_stat[39],
AREA_just_T_Statistics_w_Age$T_stat[40],
AREA_just_T_Statistics_w_Age$T_stat[41],
AREA_just_T_Statistics_w_Age$T_stat[42],
AREA_just_T_Statistics_w_Age$T_stat[43],
AREA_just_T_Statistics_w_Age$T_stat[44],
AREA_just_T_Statistics_w_Age$T_stat[45],
AREA_just_T_Statistics_w_Age$T_stat[46],
AREA_just_T_Statistics_w_Age$T_stat[47],
AREA_just_T_Statistics_w_Age$T_stat[48],
AREA_just_T_Statistics_w_Age$T_stat[49],
AREA_just_T_Statistics_w_Age$T_stat[50],
AREA_just_T_Statistics_w_Age$T_stat[51],
AREA_just_T_Statistics_w_Age$T_stat[52],
AREA_just_T_Statistics_w_Age$T_stat[53],
AREA_just_T_Statistics_w_Age$T_stat[54],
AREA_just_T_Statistics_w_Age$T_stat[55],
AREA_just_T_Statistics_w_Age$T_stat[56],
AREA_just_T_Statistics_w_Age$T_stat[57],
AREA_just_T_Statistics_w_Age$T_stat[58],
AREA_just_T_Statistics_w_Age$T_stat[59],
AREA_just_T_Statistics_w_Age$T_stat[60],
AREA_just_T_Statistics_w_Age$T_stat[61],
AREA_just_T_Statistics_w_Age$T_stat[62],
AREA_just_T_Statistics_w_Age$T_stat[63],
AREA_just_T_Statistics_w_Age$T_stat[64],
AREA_just_T_Statistics_w_Age$T_stat[65],
AREA_just_T_Statistics_w_Age$T_stat[66],
AREA_just_T_Statistics_w_Age$T_stat[67],
AREA_just_T_Statistics_w_Age$T_stat[68]))
dk_statistical_values_AREA_p_w_Age= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(AREA_just_p_Statistics_w_Age$pvalue[1],
AREA_just_p_Statistics_w_Age$pvalue[2],
AREA_just_p_Statistics_w_Age$pvalue[3],
AREA_just_p_Statistics_w_Age$pvalue[4],
AREA_just_p_Statistics_w_Age$pvalue[5],
AREA_just_p_Statistics_w_Age$pvalue[6],
AREA_just_p_Statistics_w_Age$pvalue[7],
AREA_just_p_Statistics_w_Age$pvalue[8],
AREA_just_p_Statistics_w_Age$pvalue[9],
AREA_just_p_Statistics_w_Age$pvalue[10],
AREA_just_p_Statistics_w_Age$pvalue[11],
AREA_just_p_Statistics_w_Age$pvalue[12],
AREA_just_p_Statistics_w_Age$pvalue[13],
AREA_just_p_Statistics_w_Age$pvalue[14],
AREA_just_p_Statistics_w_Age$pvalue[15],
AREA_just_p_Statistics_w_Age$pvalue[16],
AREA_just_p_Statistics_w_Age$pvalue[17],
AREA_just_p_Statistics_w_Age$pvalue[18],
AREA_just_p_Statistics_w_Age$pvalue[19],
AREA_just_p_Statistics_w_Age$pvalue[20],
AREA_just_p_Statistics_w_Age$pvalue[21],
AREA_just_p_Statistics_w_Age$pvalue[22],
AREA_just_p_Statistics_w_Age$pvalue[23],
AREA_just_p_Statistics_w_Age$pvalue[24],
AREA_just_p_Statistics_w_Age$pvalue[25],
AREA_just_p_Statistics_w_Age$pvalue[26],
AREA_just_p_Statistics_w_Age$pvalue[27],
AREA_just_p_Statistics_w_Age$pvalue[28],
AREA_just_p_Statistics_w_Age$pvalue[29],
AREA_just_p_Statistics_w_Age$pvalue[30],
AREA_just_p_Statistics_w_Age$pvalue[31],
AREA_just_p_Statistics_w_Age$pvalue[32],
AREA_just_p_Statistics_w_Age$pvalue[33],
AREA_just_p_Statistics_w_Age$pvalue[34],
AREA_just_p_Statistics_w_Age$pvalue[35],
AREA_just_p_Statistics_w_Age$pvalue[36],
AREA_just_p_Statistics_w_Age$pvalue[37],
AREA_just_p_Statistics_w_Age$pvalue[38],
AREA_just_p_Statistics_w_Age$pvalue[39],
AREA_just_p_Statistics_w_Age$pvalue[40],
AREA_just_p_Statistics_w_Age$pvalue[41],
AREA_just_p_Statistics_w_Age$pvalue[42],
AREA_just_p_Statistics_w_Age$pvalue[43],
AREA_just_p_Statistics_w_Age$pvalue[44],
AREA_just_p_Statistics_w_Age$pvalue[45],
AREA_just_p_Statistics_w_Age$pvalue[46],
AREA_just_p_Statistics_w_Age$pvalue[47],
AREA_just_p_Statistics_w_Age$pvalue[48],
AREA_just_p_Statistics_w_Age$pvalue[49],
AREA_just_p_Statistics_w_Age$pvalue[50],
AREA_just_p_Statistics_w_Age$pvalue[51],
AREA_just_p_Statistics_w_Age$pvalue[52],
AREA_just_p_Statistics_w_Age$pvalue[53],
AREA_just_p_Statistics_w_Age$pvalue[54],
AREA_just_p_Statistics_w_Age$pvalue[55],
AREA_just_p_Statistics_w_Age$pvalue[56],
AREA_just_p_Statistics_w_Age$pvalue[57],
AREA_just_p_Statistics_w_Age$pvalue[58],
AREA_just_p_Statistics_w_Age$pvalue[59],
AREA_just_p_Statistics_w_Age$pvalue[60],
AREA_just_p_Statistics_w_Age$pvalue[61],
AREA_just_p_Statistics_w_Age$pvalue[62],
AREA_just_p_Statistics_w_Age$pvalue[63],
AREA_just_p_Statistics_w_Age$pvalue[64],
AREA_just_p_Statistics_w_Age$pvalue[65],
AREA_just_p_Statistics_w_Age$pvalue[66],
AREA_just_p_Statistics_w_Age$pvalue[67],
AREA_just_p_Statistics_w_Age$pvalue[68]))
Making Figure S6
and dealing with multiple comparisons
# We correct for multiple comparisons with this call
dk_statistical_values_AREA_p_w_Age$p_adjusted<-p.adjust(dk_statistical_values_AREA_p_w_Age$p, method = "BH", n = length(dk_statistical_values_AREA_p_w_Age$p))
# We combine some dataframes
dk_statistical_values_AREA_T_p_w_Age <- dk_statistical_values_AREA_T_w_Age %>% left_join(dk_statistical_values_AREA_p_w_Age)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
AREA_Multiple_Comparisons_w_Age<-as_tibble(as.numeric(dk_statistical_values_AREA_T_p_w_Age$p_adjusted<.05))
AREA_Multiple_Comparisons_w_Age$value<-car::recode(AREA_Multiple_Comparisons_w_Age$value, "0=NA")
names(AREA_Multiple_Comparisons_w_Age)[names(AREA_Multiple_Comparisons_w_Age)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_AREA_T_w_Age_w_MultipleComparisons <- cbind(dk_statistical_values_AREA_T_w_Age, AREA_Multiple_Comparisons_w_Age)
# We make 2 figures (but store them)
AREA_p1_w_Age<-ggseg(dk_statistical_values_AREA_T_w_Age_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
AREA_p2_w_Age<-ggseg(dk_statistical_values_AREA_T_w_Age_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(AREA_p1_w_Age, AREA_p2_w_Age,labels = c('Area T-Statistics \nControlling for Age', 'Survives Multiple \n Comparison Correction'))
Table S1
dk_statistical_values_AREA_T_p_w_Age %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Area Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
## Warning: The `.dots` argument of `group_by()` is deprecated as of dplyr 1.0.0.
| Area Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 0.57982 | 0.56268 | 0.73581 |
| lh_caudalanteriorcingulate | 1.90188 | 0.05859 | 0.16600 |
| lh_caudalmiddlefrontal | 1.02918 | 0.30461 | 0.54128 |
| lh_cuneus | -0.21105 | 0.83305 | 0.91160 |
| lh_entorhinal | 1.02842 | 0.30497 | 0.54128 |
| lh_fusiform | 0.73975 | 0.46030 | 0.66597 |
| lh_inferiorparietal | 0.54779 | 0.58443 | 0.74984 |
| lh_inferiortemporal | 3.81752 | 0.00018 | 0.00243 |
| lh_isthmuscingulate | 0.29369 | 0.76929 | 0.90704 |
| lh_lateraloccipital | -0.23380 | 0.81537 | 0.91160 |
| lh_lateralorbitofrontal | 4.06110 | 0.00007 | 0.00158 |
| lh_lingual | 0.14441 | 0.88531 | 0.92618 |
| lh_medialorbitofrontal | 3.02030 | 0.00285 | 0.02765 |
| lh_middletemporal | 2.37393 | 0.01852 | 0.07873 |
| lh_parahippocampal | 0.68611 | 0.49342 | 0.68475 |
| lh_paracentral | 0.66147 | 0.50905 | 0.69231 |
| lh_parsopercularis | 0.85044 | 0.39607 | 0.59851 |
| lh_parsorbitalis | 2.43934 | 0.01556 | 0.07056 |
| lh_parstriangularis | 2.02326 | 0.04434 | 0.14359 |
| lh_pericalcarine | 0.20880 | 0.83481 | 0.91160 |
| lh_postcentral | -0.16417 | 0.86976 | 0.92412 |
| lh_posteriorcingulate | 2.95455 | 0.00350 | 0.02973 |
| lh_precentral | -1.00420 | 0.31646 | 0.54128 |
| lh_precuneus | 2.17148 | 0.03104 | 0.11727 |
| lh_rostralanteriorcingulate | 2.80319 | 0.00555 | 0.04190 |
| lh_rostralmiddlefrontal | 4.50049 | 0.00001 | 0.00039 |
| lh_superiorfrontal | 1.82309 | 0.06975 | 0.18241 |
| lh_superiorparietal | 1.23505 | 0.21823 | 0.44888 |
| lh_superiortemporal | 1.00019 | 0.31840 | 0.54128 |
| lh_supramarginal | 1.55479 | 0.12154 | 0.28499 |
| lh_frontalpole | 2.10131 | 0.03684 | 0.12583 |
| lh_temporalpole | 1.92013 | 0.05623 | 0.16600 |
| lh_transversetemporal | 0.75279 | 0.45244 | 0.66597 |
| lh_insula | 2.09935 | 0.03701 | 0.12583 |
| rh_bankssts | 0.96266 | 0.33685 | 0.54659 |
| rh_caudalanteriorcingulate | 0.38385 | 0.70149 | 0.85181 |
| rh_caudalmiddlefrontal | 1.90705 | 0.05791 | 0.16600 |
| rh_cuneus | -0.07490 | 0.94037 | 0.95872 |
| rh_entorhinal | 0.96117 | 0.33760 | 0.54659 |
| rh_fusiform | 1.88307 | 0.06111 | 0.16621 |
| rh_inferiorparietal | 0.60074 | 0.54867 | 0.73157 |
| rh_inferiortemporal | 3.24146 | 0.00139 | 0.01573 |
| rh_isthmuscingulate | 1.10064 | 0.27234 | 0.52912 |
| rh_lateraloccipital | 0.90945 | 0.36418 | 0.57464 |
| rh_lateralorbitofrontal | 3.86705 | 0.00015 | 0.00243 |
| rh_lingual | -0.40776 | 0.68387 | 0.84552 |
| rh_medialorbitofrontal | 4.73476 | 0.00000 | 0.00028 |
| rh_middletemporal | 2.27388 | 0.02401 | 0.09604 |
| rh_parahippocampal | -0.26718 | 0.78960 | 0.91005 |
| rh_paracentral | 0.89502 | 0.37183 | 0.57464 |
| rh_parsopercularis | 1.21848 | 0.22444 | 0.44888 |
| rh_parsorbitalis | 2.51382 | 0.01271 | 0.06174 |
| rh_parstriangularis | 0.04227 | 0.96632 | 0.96632 |
| rh_pericalcarine | -0.19630 | 0.84457 | 0.91160 |
| rh_postcentral | 1.50975 | 0.13265 | 0.30067 |
| rh_posteriorcingulate | 1.34633 | 0.17968 | 0.39414 |
| rh_precentral | 0.28798 | 0.77365 | 0.90704 |
| rh_precuneus | 2.59729 | 0.01008 | 0.05711 |
| rh_rostralanteriorcingulate | 2.56689 | 0.01097 | 0.05740 |
| rh_rostralmiddlefrontal | 2.63523 | 0.00905 | 0.05595 |
| rh_superiorfrontal | 1.68172 | 0.09415 | 0.22864 |
| rh_superiorparietal | 0.70353 | 0.48252 | 0.68357 |
| rh_superiortemporal | 1.27249 | 0.20464 | 0.43486 |
| rh_supramarginal | 2.73600 | 0.00676 | 0.04600 |
| rh_frontalpole | 0.51845 | 0.60471 | 0.76148 |
| rh_temporalpole | 1.05056 | 0.29470 | 0.54128 |
| rh_transversetemporal | -0.06955 | 0.94462 | 0.95872 |
| rh_insula | 1.75034 | 0.08156 | 0.20540 |
Descriptive Statistics about t-values for Area
And MRI Quality (controlling for Age)
range(dk_statistical_values_AREA_T_p_w_Age$t)
## [1] -1.004204 4.734759
mean(dk_statistical_values_AREA_T_p_w_Age$t)
## [1] 1.424216
sd(dk_statistical_values_AREA_T_p_w_Age$t)
## [1] 1.25492
table(dk_statistical_values_AREA_T_p_w_Age$p>.05)
##
## FALSE TRUE
## 21 47
table(is.na(AREA_Multiple_Comparisons_w_Age))
##
## FALSE TRUE
## 10 58
We now do the same thing for cortical thickness
[ Same tibbling and regression loops, etc.]
OnlySubsPassingVisualQC_Freesurfer_THICKNESS<-OnlySubsPassingVisualQC[,149:217]
OnlySubsPassingVisualQC_Freesurfer_THICKNESS<-OnlySubsPassingVisualQC_Freesurfer_THICKNESS %>% dplyr::select(-c(lh_MeanThickness_thickness))
OnlySubsPassingVisualQC_Freesurfer_THICKNESS$CAT12_QC_Weighted_Average<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
## Add Age and QC "back in"
THICKNESS_for_Figure<-OnlySubsPassingVisualQC_Freesurfer_THICKNESS[,1:68]
CAT12Ratings<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Age<-OnlySubsPassingVisualQC$Basic_Demos.Age
## Regression Loop, with Thickness as DV and Age & QC as IVs
n<-68
THICKNESS_Loop_to_Extract_Tstats_w_Age <- lapply(1:n, function(x) lm(THICKNESS_for_Figure[,x] ~ Age + CAT12Ratings))
#Pulling out t-statistics, etc.
THICKNESS_summaries_w_Age <- lapply(THICKNESS_Loop_to_Extract_Tstats_w_Age, summary)
THICKNESS_saved_T_w_Age<-lapply(THICKNESS_summaries_w_Age, function(x) x$coefficients[, c(3)])
THICKNESS_T_Statistics_temp_w_Age<-lapply(THICKNESS_saved_T_w_Age, function (x) x[c('CAT12Ratings')])
THICKNESS_just_T_Statistics_w_Age<-do.call(rbind.data.frame, THICKNESS_T_Statistics_temp_w_Age)
names(THICKNESS_just_T_Statistics_w_Age)[names(THICKNESS_just_T_Statistics_w_Age)=="c.1.90538341704119...0.806632158222817..4.88302055579909..1.1604985261882.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
THICKNESS_just_T_Statistics_w_Age$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_T_Statistics_w_Age<-THICKNESS_just_T_Statistics_w_Age[, c(2,1)]
## Pull out P-Values from Regressions
THICKNESS_saved_p_w_Age<-lapply(THICKNESS_summaries_w_Age, function(x) x$coefficients[, c(4)])
THICKNESS_p_Statistics_temp_w_Age<-lapply(THICKNESS_saved_p_w_Age, function (x) x[c('CAT12Ratings')])
THICKNESS_just_p_Statistics_w_Age<-do.call(rbind.data.frame, THICKNESS_p_Statistics_temp_w_Age)
names(THICKNESS_just_p_Statistics_w_Age)[names(THICKNESS_just_p_Statistics_w_Age)=="c.0.058129664114012..0.42081324424534..2.09955016547069e.06.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
THICKNESS_just_p_Statistics_w_Age$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_p_Statistics_w_Age<-THICKNESS_just_p_Statistics_w_Age[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse);library(stats);library(gt);library(cowplot);library(dplyr)
dk_statistical_values_THICKNESS_T_w_Age= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(THICKNESS_just_T_Statistics_w_Age$T_stat[1],
THICKNESS_just_T_Statistics_w_Age$T_stat[2],
THICKNESS_just_T_Statistics_w_Age$T_stat[3],
THICKNESS_just_T_Statistics_w_Age$T_stat[4],
THICKNESS_just_T_Statistics_w_Age$T_stat[5],
THICKNESS_just_T_Statistics_w_Age$T_stat[6],
THICKNESS_just_T_Statistics_w_Age$T_stat[7],
THICKNESS_just_T_Statistics_w_Age$T_stat[8],
THICKNESS_just_T_Statistics_w_Age$T_stat[9],
THICKNESS_just_T_Statistics_w_Age$T_stat[10],
THICKNESS_just_T_Statistics_w_Age$T_stat[11],
THICKNESS_just_T_Statistics_w_Age$T_stat[12],
THICKNESS_just_T_Statistics_w_Age$T_stat[13],
THICKNESS_just_T_Statistics_w_Age$T_stat[14],
THICKNESS_just_T_Statistics_w_Age$T_stat[15],
THICKNESS_just_T_Statistics_w_Age$T_stat[16],
THICKNESS_just_T_Statistics_w_Age$T_stat[17],
THICKNESS_just_T_Statistics_w_Age$T_stat[18],
THICKNESS_just_T_Statistics_w_Age$T_stat[19],
THICKNESS_just_T_Statistics_w_Age$T_stat[20],
THICKNESS_just_T_Statistics_w_Age$T_stat[21],
THICKNESS_just_T_Statistics_w_Age$T_stat[22],
THICKNESS_just_T_Statistics_w_Age$T_stat[23],
THICKNESS_just_T_Statistics_w_Age$T_stat[24],
THICKNESS_just_T_Statistics_w_Age$T_stat[25],
THICKNESS_just_T_Statistics_w_Age$T_stat[26],
THICKNESS_just_T_Statistics_w_Age$T_stat[27],
THICKNESS_just_T_Statistics_w_Age$T_stat[28],
THICKNESS_just_T_Statistics_w_Age$T_stat[29],
THICKNESS_just_T_Statistics_w_Age$T_stat[30],
THICKNESS_just_T_Statistics_w_Age$T_stat[31],
THICKNESS_just_T_Statistics_w_Age$T_stat[32],
THICKNESS_just_T_Statistics_w_Age$T_stat[33],
THICKNESS_just_T_Statistics_w_Age$T_stat[34],
THICKNESS_just_T_Statistics_w_Age$T_stat[35],
THICKNESS_just_T_Statistics_w_Age$T_stat[36],
THICKNESS_just_T_Statistics_w_Age$T_stat[37],
THICKNESS_just_T_Statistics_w_Age$T_stat[38],
THICKNESS_just_T_Statistics_w_Age$T_stat[39],
THICKNESS_just_T_Statistics_w_Age$T_stat[40],
THICKNESS_just_T_Statistics_w_Age$T_stat[41],
THICKNESS_just_T_Statistics_w_Age$T_stat[42],
THICKNESS_just_T_Statistics_w_Age$T_stat[43],
THICKNESS_just_T_Statistics_w_Age$T_stat[44],
THICKNESS_just_T_Statistics_w_Age$T_stat[45],
THICKNESS_just_T_Statistics_w_Age$T_stat[46],
THICKNESS_just_T_Statistics_w_Age$T_stat[47],
THICKNESS_just_T_Statistics_w_Age$T_stat[48],
THICKNESS_just_T_Statistics_w_Age$T_stat[49],
THICKNESS_just_T_Statistics_w_Age$T_stat[50],
THICKNESS_just_T_Statistics_w_Age$T_stat[51],
THICKNESS_just_T_Statistics_w_Age$T_stat[52],
THICKNESS_just_T_Statistics_w_Age$T_stat[53],
THICKNESS_just_T_Statistics_w_Age$T_stat[54],
THICKNESS_just_T_Statistics_w_Age$T_stat[55],
THICKNESS_just_T_Statistics_w_Age$T_stat[56],
THICKNESS_just_T_Statistics_w_Age$T_stat[57],
THICKNESS_just_T_Statistics_w_Age$T_stat[58],
THICKNESS_just_T_Statistics_w_Age$T_stat[59],
THICKNESS_just_T_Statistics_w_Age$T_stat[60],
THICKNESS_just_T_Statistics_w_Age$T_stat[61],
THICKNESS_just_T_Statistics_w_Age$T_stat[62],
THICKNESS_just_T_Statistics_w_Age$T_stat[63],
THICKNESS_just_T_Statistics_w_Age$T_stat[64],
THICKNESS_just_T_Statistics_w_Age$T_stat[65],
THICKNESS_just_T_Statistics_w_Age$T_stat[66],
THICKNESS_just_T_Statistics_w_Age$T_stat[67],
THICKNESS_just_T_Statistics_w_Age$T_stat[68]))
dk_statistical_values_THICKNESS_p_w_Age= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(THICKNESS_just_p_Statistics_w_Age$pvalue[1],
THICKNESS_just_p_Statistics_w_Age$pvalue[2],
THICKNESS_just_p_Statistics_w_Age$pvalue[3],
THICKNESS_just_p_Statistics_w_Age$pvalue[4],
THICKNESS_just_p_Statistics_w_Age$pvalue[5],
THICKNESS_just_p_Statistics_w_Age$pvalue[6],
THICKNESS_just_p_Statistics_w_Age$pvalue[7],
THICKNESS_just_p_Statistics_w_Age$pvalue[8],
THICKNESS_just_p_Statistics_w_Age$pvalue[9],
THICKNESS_just_p_Statistics_w_Age$pvalue[10],
THICKNESS_just_p_Statistics_w_Age$pvalue[11],
THICKNESS_just_p_Statistics_w_Age$pvalue[12],
THICKNESS_just_p_Statistics_w_Age$pvalue[13],
THICKNESS_just_p_Statistics_w_Age$pvalue[14],
THICKNESS_just_p_Statistics_w_Age$pvalue[15],
THICKNESS_just_p_Statistics_w_Age$pvalue[16],
THICKNESS_just_p_Statistics_w_Age$pvalue[17],
THICKNESS_just_p_Statistics_w_Age$pvalue[18],
THICKNESS_just_p_Statistics_w_Age$pvalue[19],
THICKNESS_just_p_Statistics_w_Age$pvalue[20],
THICKNESS_just_p_Statistics_w_Age$pvalue[21],
THICKNESS_just_p_Statistics_w_Age$pvalue[22],
THICKNESS_just_p_Statistics_w_Age$pvalue[23],
THICKNESS_just_p_Statistics_w_Age$pvalue[24],
THICKNESS_just_p_Statistics_w_Age$pvalue[25],
THICKNESS_just_p_Statistics_w_Age$pvalue[26],
THICKNESS_just_p_Statistics_w_Age$pvalue[27],
THICKNESS_just_p_Statistics_w_Age$pvalue[28],
THICKNESS_just_p_Statistics_w_Age$pvalue[29],
THICKNESS_just_p_Statistics_w_Age$pvalue[30],
THICKNESS_just_p_Statistics_w_Age$pvalue[31],
THICKNESS_just_p_Statistics_w_Age$pvalue[32],
THICKNESS_just_p_Statistics_w_Age$pvalue[33],
THICKNESS_just_p_Statistics_w_Age$pvalue[34],
THICKNESS_just_p_Statistics_w_Age$pvalue[35],
THICKNESS_just_p_Statistics_w_Age$pvalue[36],
THICKNESS_just_p_Statistics_w_Age$pvalue[37],
THICKNESS_just_p_Statistics_w_Age$pvalue[38],
THICKNESS_just_p_Statistics_w_Age$pvalue[39],
THICKNESS_just_p_Statistics_w_Age$pvalue[40],
THICKNESS_just_p_Statistics_w_Age$pvalue[41],
THICKNESS_just_p_Statistics_w_Age$pvalue[42],
THICKNESS_just_p_Statistics_w_Age$pvalue[43],
THICKNESS_just_p_Statistics_w_Age$pvalue[44],
THICKNESS_just_p_Statistics_w_Age$pvalue[45],
THICKNESS_just_p_Statistics_w_Age$pvalue[46],
THICKNESS_just_p_Statistics_w_Age$pvalue[47],
THICKNESS_just_p_Statistics_w_Age$pvalue[48],
THICKNESS_just_p_Statistics_w_Age$pvalue[49],
THICKNESS_just_p_Statistics_w_Age$pvalue[50],
THICKNESS_just_p_Statistics_w_Age$pvalue[51],
THICKNESS_just_p_Statistics_w_Age$pvalue[52],
THICKNESS_just_p_Statistics_w_Age$pvalue[53],
THICKNESS_just_p_Statistics_w_Age$pvalue[54],
THICKNESS_just_p_Statistics_w_Age$pvalue[55],
THICKNESS_just_p_Statistics_w_Age$pvalue[56],
THICKNESS_just_p_Statistics_w_Age$pvalue[57],
THICKNESS_just_p_Statistics_w_Age$pvalue[58],
THICKNESS_just_p_Statistics_w_Age$pvalue[59],
THICKNESS_just_p_Statistics_w_Age$pvalue[60],
THICKNESS_just_p_Statistics_w_Age$pvalue[61],
THICKNESS_just_p_Statistics_w_Age$pvalue[62],
THICKNESS_just_p_Statistics_w_Age$pvalue[63],
THICKNESS_just_p_Statistics_w_Age$pvalue[64],
THICKNESS_just_p_Statistics_w_Age$pvalue[65],
THICKNESS_just_p_Statistics_w_Age$pvalue[66],
THICKNESS_just_p_Statistics_w_Age$pvalue[67],
THICKNESS_just_p_Statistics_w_Age$pvalue[68]))
Figure S7
# We correct for multiple comparisons with this call
dk_statistical_values_THICKNESS_p_w_Age$p_adjusted<-p.adjust(dk_statistical_values_THICKNESS_p_w_Age$p, method = "BH", n = length(dk_statistical_values_THICKNESS_p_w_Age$p))
# We combine some dataframes
dk_statistical_values_THICKNESS_T_p_w_Age <- dk_statistical_values_THICKNESS_T_w_Age %>% left_join(dk_statistical_values_THICKNESS_p_w_Age)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
THICKNESS_Multiple_Comparisons_w_Age<-as_tibble(as.numeric(dk_statistical_values_THICKNESS_T_p_w_Age$p_adjusted<.05))
THICKNESS_Multiple_Comparisons_w_Age$value<-car::recode(THICKNESS_Multiple_Comparisons_w_Age$value, "0=NA")
names(THICKNESS_Multiple_Comparisons_w_Age)[names(THICKNESS_Multiple_Comparisons_w_Age)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_THICKNESS_T_w_Age_w_MultipleComparisons <- cbind(dk_statistical_values_THICKNESS_T_w_Age, THICKNESS_Multiple_Comparisons_w_Age)
# We make 2 figures (but store them)
THICKNESS_p1_w_Age<-ggseg(dk_statistical_values_THICKNESS_T_w_Age_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
THICKNESS_p2_w_Age<-ggseg(dk_statistical_values_THICKNESS_T_w_Age_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(THICKNESS_p1_w_Age, THICKNESS_p2_w_Age,labels = c('THICKNESS T-Statistics \nControlling for Age', 'Survives Multiple \n Comparison Correction'))
Table S1
dk_statistical_values_THICKNESS_T_p_w_Age %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('THICKNESS Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| THICKNESS Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 1.90538 | 0.05813 | 0.09172 |
| lh_caudalanteriorcingulate | -0.80663 | 0.42081 | 0.48501 |
| lh_caudalmiddlefrontal | 4.88302 | 0.00000 | 0.00001 |
| lh_cuneus | 1.16050 | 0.24720 | 0.31128 |
| lh_entorhinal | 5.38435 | 0.00000 | 0.00000 |
| lh_fusiform | 3.92614 | 0.00012 | 0.00047 |
| lh_inferiorparietal | 4.81504 | 0.00000 | 0.00001 |
| lh_inferiortemporal | 3.41117 | 0.00078 | 0.00212 |
| lh_isthmuscingulate | -1.26153 | 0.20855 | 0.27590 |
| lh_lateraloccipital | 4.05341 | 0.00007 | 0.00030 |
| lh_lateralorbitofrontal | 3.55681 | 0.00047 | 0.00138 |
| lh_lingual | -0.52930 | 0.59717 | 0.63449 |
| lh_medialorbitofrontal | 0.77710 | 0.43799 | 0.49639 |
| lh_middletemporal | 3.10677 | 0.00216 | 0.00506 |
| lh_parahippocampal | 0.92049 | 0.35840 | 0.42757 |
| lh_paracentral | 3.38567 | 0.00085 | 0.00223 |
| lh_parsopercularis | 2.58927 | 0.01031 | 0.02061 |
| lh_parsorbitalis | 2.12624 | 0.03468 | 0.05895 |
| lh_parstriangularis | 2.16960 | 0.03119 | 0.05438 |
| lh_pericalcarine | -1.00544 | 0.31587 | 0.39053 |
| lh_postcentral | 2.79668 | 0.00565 | 0.01240 |
| lh_posteriorcingulate | 0.62006 | 0.53590 | 0.57844 |
| lh_precentral | 6.67051 | 0.00000 | 0.00000 |
| lh_precuneus | 2.53851 | 0.01188 | 0.02243 |
| lh_rostralanteriorcingulate | -0.90398 | 0.36707 | 0.43035 |
| lh_rostralmiddlefrontal | 1.22553 | 0.22178 | 0.28455 |
| lh_superiorfrontal | 2.92666 | 0.00381 | 0.00864 |
| lh_superiorparietal | 5.19599 | 0.00000 | 0.00000 |
| lh_superiortemporal | 5.03583 | 0.00000 | 0.00001 |
| lh_supramarginal | 5.41472 | 0.00000 | 0.00000 |
| lh_frontalpole | -0.64647 | 0.51870 | 0.56889 |
| lh_temporalpole | 5.71823 | 0.00000 | 0.00000 |
| lh_transversetemporal | 1.63734 | 0.10309 | 0.15579 |
| lh_insula | 2.04661 | 0.04197 | 0.06795 |
| rh_bankssts | 2.65854 | 0.00847 | 0.01745 |
| rh_caudalanteriorcingulate | 0.03149 | 0.97491 | 0.97491 |
| rh_caudalmiddlefrontal | 5.13957 | 0.00000 | 0.00001 |
| rh_cuneus | 2.08253 | 0.03853 | 0.06391 |
| rh_entorhinal | 5.34761 | 0.00000 | 0.00000 |
| rh_fusiform | 3.69451 | 0.00028 | 0.00099 |
| rh_inferiorparietal | 2.68286 | 0.00790 | 0.01678 |
| rh_inferiortemporal | 3.68712 | 0.00029 | 0.00099 |
| rh_isthmuscingulate | -1.49763 | 0.13577 | 0.19643 |
| rh_lateraloccipital | 3.66646 | 0.00031 | 0.00101 |
| rh_lateralorbitofrontal | 3.58833 | 0.00042 | 0.00129 |
| rh_lingual | 0.66721 | 0.50539 | 0.56339 |
| rh_medialorbitofrontal | -1.53480 | 0.12637 | 0.18681 |
| rh_middletemporal | 4.09782 | 0.00006 | 0.00029 |
| rh_parahippocampal | 2.41969 | 0.01641 | 0.03015 |
| rh_paracentral | 3.88461 | 0.00014 | 0.00052 |
| rh_parsopercularis | 3.54137 | 0.00049 | 0.00140 |
| rh_parsorbitalis | 0.93937 | 0.34865 | 0.42336 |
| rh_parstriangularis | 1.89615 | 0.05935 | 0.09172 |
| rh_pericalcarine | 0.33284 | 0.73959 | 0.77373 |
| rh_postcentral | 1.48250 | 0.13974 | 0.19797 |
| rh_posteriorcingulate | -0.23623 | 0.81349 | 0.82563 |
| rh_precentral | 5.64828 | 0.00000 | 0.00000 |
| rh_precuneus | 2.17973 | 0.03042 | 0.05438 |
| rh_rostralanteriorcingulate | 1.25478 | 0.21099 | 0.27590 |
| rh_rostralmiddlefrontal | 1.25608 | 0.21052 | 0.27590 |
| rh_superiorfrontal | 2.55823 | 0.01124 | 0.02184 |
| rh_superiorparietal | 5.01753 | 0.00000 | 0.00001 |
| rh_superiortemporal | 4.05993 | 0.00007 | 0.00030 |
| rh_supramarginal | 3.20816 | 0.00155 | 0.00390 |
| rh_frontalpole | 0.23953 | 0.81093 | 0.82563 |
| rh_temporalpole | 4.97308 | 0.00000 | 0.00001 |
| rh_transversetemporal | 3.10675 | 0.00216 | 0.00506 |
| rh_insula | 1.31290 | 0.19068 | 0.26462 |
Descriptive Statistics about t-values for Thickness
And MRI Quality (controlling for Age)
range(dk_statistical_values_THICKNESS_T_p_w_Age$t)
## [1] -1.534803 6.670513
mean(dk_statistical_values_THICKNESS_T_p_w_Age$t)
## [1] 2.473988
sd(dk_statistical_values_THICKNESS_T_p_w_Age$t)
## [1] 2.038659
table(dk_statistical_values_THICKNESS_T_p_w_Age$p>.05)
##
## FALSE TRUE
## 42 26
table(is.na(THICKNESS_Multiple_Comparisons_w_Age))
##
## FALSE TRUE
## 37 31
Final set of loops and data organization
This final time for the subcortical volumes
[ Same tibbling and regression loops, etc.]
Figure S8
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC[,14:58]
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC_Freesurfer_ASEG %>% dplyr::select(-c(Left.Cerebellum.White.Matter, Left.Cerebellum.Cortex, Left.Lateral.Ventricle,Left.Inf.Lat.Vent,X3rd.Ventricle,X4th.Ventricle,CSF,Left.vessel,Left.choroid.plexus,Right.Cerebellum.White.Matter,Right.Cerebellum.Cortex,Right.Lateral.Ventricle,Right.Inf.Lat.Vent,Right.vessel,Right.choroid.plexus,X5th.Ventricle,WM.hypointensities,Left.WM.hypointensities,Right.WM.hypointensities,non.WM.hypointensities,Left.non.WM.hypointensities,Right.non.WM.hypointensities,Optic.Chiasm))
CAT12Ratings<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Age<-OnlySubsPassingVisualQC$Basic_Demos.Age
## Regression Loop, with Aseg as DV and Age & QC as IVs
n<-22
ASEG_Loop_to_Extract_Tstats_w_Age <- lapply(1:n, function(x) lm(OnlySubsPassingVisualQC_Freesurfer_ASEG[,x] ~ Age + CAT12Ratings))
## Pull out T-Statistics from Regressions
ASEG_summaries_w_Age <- lapply(ASEG_Loop_to_Extract_Tstats_w_Age, summary)
ASEG_saved_T_w_Age<-lapply(ASEG_summaries_w_Age, function(x) x$coefficients[, c(3)])
ASEG_T_Statistics_temp_w_Age<-lapply(ASEG_saved_T_w_Age, function (x) x[c('CAT12Ratings')])
ASEG_just_T_Statistics_w_Age<-do.call(rbind.data.frame, ASEG_T_Statistics_temp_w_Age)
names(ASEG_just_T_Statistics_w_Age)[names(ASEG_just_T_Statistics_w_Age)=="c..0.553957701778685..0.258417680848974..1.46516491411385..0.924971242359592.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
ASEG_just_T_Statistics_w_Age$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_T_Statistics_w_Age<-ASEG_just_T_Statistics_w_Age[, c(2,1)]
## Pull out P-Values from Regressions
ASEG_saved_p_w_Age<-lapply(ASEG_summaries_w_Age, function(x) x$coefficients[, c(4)])
ASEG_p_Statistics_temp_w_Age<-lapply(ASEG_saved_p_w_Age, function (x) x[c('CAT12Ratings')])
ASEG_just_p_Statistics_w_Age<-do.call(rbind.data.frame, ASEG_p_Statistics_temp_w_Age)
names(ASEG_just_p_Statistics_w_Age)[names(ASEG_just_p_Statistics_w_Age)=="c.0.580211537902136..0.796343836515753..0.144407927151412..0.356068407591207.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
ASEG_just_p_Statistics_w_Age$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_p_Statistics_w_Age<-ASEG_just_p_Statistics_w_Age[, c(2,1)]
# Make tibble to eventually put into ggseg [for t-statistics]
aseg_statistical_values_T_w_Age= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
t=c(ASEG_just_T_Statistics_w_Age$T_stat[1],
ASEG_just_T_Statistics_w_Age$T_stat[2],
ASEG_just_T_Statistics_w_Age$T_stat[3],
ASEG_just_T_Statistics_w_Age$T_stat[4],
ASEG_just_T_Statistics_w_Age$T_stat[5],
ASEG_just_T_Statistics_w_Age$T_stat[6],
ASEG_just_T_Statistics_w_Age$T_stat[7],
ASEG_just_T_Statistics_w_Age$T_stat[8],
ASEG_just_T_Statistics_w_Age$T_stat[9],
ASEG_just_T_Statistics_w_Age$T_stat[10],
ASEG_just_T_Statistics_w_Age$T_stat[11],
ASEG_just_T_Statistics_w_Age$T_stat[12],
ASEG_just_T_Statistics_w_Age$T_stat[13],
ASEG_just_T_Statistics_w_Age$T_stat[14],
ASEG_just_T_Statistics_w_Age$T_stat[15],
ASEG_just_T_Statistics_w_Age$T_stat[16],
ASEG_just_T_Statistics_w_Age$T_stat[17],
ASEG_just_T_Statistics_w_Age$T_stat[18],
ASEG_just_T_Statistics_w_Age$T_stat[19],
ASEG_just_T_Statistics_w_Age$T_stat[20],
ASEG_just_T_Statistics_w_Age$T_stat[21],
ASEG_just_T_Statistics_w_Age$T_stat[22]))
# Make tibble to eventually put into ggseg [for p-values]
aseg_statistical_values_p_w_Age= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
p=c(ASEG_just_p_Statistics_w_Age$pvalue[1],
ASEG_just_p_Statistics_w_Age$pvalue[2],
ASEG_just_p_Statistics_w_Age$pvalue[3],
ASEG_just_p_Statistics_w_Age$pvalue[4],
ASEG_just_p_Statistics_w_Age$pvalue[5],
ASEG_just_p_Statistics_w_Age$pvalue[6],
ASEG_just_p_Statistics_w_Age$pvalue[7],
ASEG_just_p_Statistics_w_Age$pvalue[8],
ASEG_just_p_Statistics_w_Age$pvalue[9],
ASEG_just_p_Statistics_w_Age$pvalue[10],
ASEG_just_p_Statistics_w_Age$pvalue[11],
ASEG_just_p_Statistics_w_Age$pvalue[12],
ASEG_just_p_Statistics_w_Age$pvalue[13],
ASEG_just_p_Statistics_w_Age$pvalue[14],
ASEG_just_p_Statistics_w_Age$pvalue[15],
ASEG_just_p_Statistics_w_Age$pvalue[16],
ASEG_just_p_Statistics_w_Age$pvalue[17],
ASEG_just_p_Statistics_w_Age$pvalue[18],
ASEG_just_p_Statistics_w_Age$pvalue[19],
ASEG_just_p_Statistics_w_Age$pvalue[20],
ASEG_just_p_Statistics_w_Age$pvalue[21],
ASEG_just_p_Statistics_w_Age$pvalue[22]))
# Multiple Comparison Correction
aseg_statistical_values_p_w_Age$p_adjusted<-p.adjust(aseg_statistical_values_p_w_Age$p, method = "BH", n = length(aseg_statistical_values_p_w_Age$p))
aseg_statistical_values_T_p_w_Age <- aseg_statistical_values_T_w_Age %>% left_join(aseg_statistical_values_p_w_Age)
## Joining, by = "label"
Aseg_Multiple_Comparisons_w_Age<-as_tibble(as.numeric(aseg_statistical_values_T_p_w_Age$p_adjusted<.05))
Aseg_Multiple_Comparisons_w_Age$value<-car::recode(Aseg_Multiple_Comparisons_w_Age$value, "0=NA")
names(Aseg_Multiple_Comparisons_w_Age)[names(Aseg_Multiple_Comparisons_w_Age)=="value"] <- "Survives_Multiple_Comparison_Correction"
aseg_statistical_values_T_w_MultipleComparisons_w_Age <- cbind(aseg_statistical_values_T_w_Age, Aseg_Multiple_Comparisons_w_Age)
aseg_p1_w_Age<-ggseg(aseg_statistical_values_T_w_Age,atlas=aseg,position = "stacked",mapping=aes(fill=t,color=Survives_Multiple_Comparison_Correction),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75))+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbens-area 0.249
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumbens-area 1.40
aseg_p2_w_Age<-ggseg(aseg_statistical_values_T_w_MultipleComparisons_w_Age,atlas=aseg,position = "stacked",mapping=aes(fill=Survives_Multiple_Comparison_Correction),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t Survives_Multiple_Comparis…
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbe… 0.249 NA
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumb… 1.40 NA
plot_grid(aseg_p1_w_Age, aseg_p2_w_Age,labels = c('Subcortical Volumes \n T-Statistics', 'Survives Multiple \n Comparison Correction'))
Again, we also output a Table showing the stats for
QC and aseg volumes
with adjusted and unadjusted p-values
For the folks who like tables, etc.
Table 4
aseg_statistical_values_T_p_w_Age %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Aseg_Volume' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Aseg_Volume | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| Left-Thalamus-Proper | -0.55396 | 0.58021 | 0.90759 |
| Left-Caudate | 0.25842 | 0.79634 | 0.90759 |
| Left-Putamen | 1.46516 | 0.14441 | 0.39639 |
| Left-Pallidum | 0.92497 | 0.35607 | 0.60258 |
| brain-stem | 0.41353 | 0.67965 | 0.90759 |
| Left-Hippocampus | 0.34442 | 0.73089 | 0.90759 |
| Left-Amygdala | 2.80652 | 0.00549 | 0.08779 |
| Left-Accumbens-area | 0.24907 | 0.80356 | 0.90759 |
| Left-VentralDC | -0.07451 | 0.94068 | 0.95295 |
| Right-Thalamus-Proper | -0.97367 | 0.33137 | 0.60258 |
| Right-Caudate | 0.22129 | 0.82508 | 0.90759 |
| Right-Putamen | 1.57158 | 0.11759 | 0.39639 |
| Right-Pallidum | 1.42996 | 0.15425 | 0.39639 |
| Right-Hippocampus | 0.26022 | 0.79495 | 0.90759 |
| Right-Amygdala | 1.41349 | 0.15903 | 0.39639 |
| Right-Accumbens-area | 1.40290 | 0.16216 | 0.39639 |
| Right-VentralDC | 0.05908 | 0.95295 | 0.95295 |
| cc-posterior | 2.67914 | 0.00798 | 0.08779 |
| cc-mid-posterior | 1.12309 | 0.26271 | 0.52542 |
| cc-central | 1.18980 | 0.23550 | 0.51810 |
| cc-mid-anterior | 1.77694 | 0.07706 | 0.39639 |
| cc-anterior | 1.75565 | 0.08064 | 0.39639 |
range(aseg_statistical_values_T_p_w_Age$t)
## [1] -0.9736661 2.8065203
mean(aseg_statistical_values_T_p_w_Age$t)
## [1] 0.8974131
sd(aseg_statistical_values_T_p_w_Age$t)
## [1] 0.9644998
table(aseg_statistical_values_T_p_w_Age$p>.05)
##
## FALSE TRUE
## 2 20
table(is.na(Aseg_Multiple_Comparisons_w_Age))
##
## TRUE
## 22
Work related to: S5. Association Between CAT12 Scan Rating and Freesurfer Outputs, Controlling Freesurfer’s Euler Number Similar code to the main manuscript
Major exception is that the regression loops
Also include Euler (aka Surface Holes) as an independent variable
combined<-read.csv("HBN_combined_2021_03_04_full.csv")
combined<-subset(combined,combined$CAT12_QC_Weighted_Average!="NA")
OnlySubsPassingVisualQC<-subset(combined,combined$passing==1)
OnlySubsPassingVisualQC_Freesurfer_AREA<-OnlySubsPassingVisualQC[,78:147]
OnlySubsPassingVisualQC_Freesurfer_AREA<-OnlySubsPassingVisualQC_Freesurfer_AREA %>% dplyr::select(-c(lh_WhiteSurfArea_area,eTIV))
OnlySubsPassingVisualQC_Freesurfer_AREA$CAT12_QC_Weighted_Average<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
n<-68
AREA_for_Figure<-OnlySubsPassingVisualQC_Freesurfer_AREA[,1:68]
CAT12Ratings<-OnlySubsPassingVisualQC_Freesurfer_AREA[,69]
Euler<-OnlySubsPassingVisualQC$SurfaceHoles
#Regression Loops
AREA_Loop_to_Extract_Tstats_w_Euler <- lapply(1:n, function(x) lm(AREA_for_Figure[,x] ~ Euler + CAT12Ratings))
#Pulling out t-statistics, etc.
AREA_summaries_w_Euler <- lapply(AREA_Loop_to_Extract_Tstats_w_Euler, summary)
AREA_saved_T_w_Euler<-lapply(AREA_summaries_w_Euler, function(x) x$coefficients[, c(3)])
AREA_T_Statistics_temp_w_Euler<-lapply(AREA_saved_T_w_Euler, function (x) x[c('CAT12Ratings')])
AREA_just_T_Statistics_w_Euler<-do.call(rbind.data.frame, AREA_T_Statistics_temp_w_Euler)
names(AREA_just_T_Statistics_w_Euler)[names(AREA_just_T_Statistics_w_Euler)=="c.1.52678824628622..1.42081686698055..0.757183029370344...0.714713543188584.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
AREA_just_T_Statistics_w_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_T_Statistics_w_Euler<-AREA_just_T_Statistics_w_Euler[, c(2,1)]
## Pull out P-Values from Regressions
AREA_saved_p_w_Euler<-lapply(AREA_summaries_w_Euler, function(x) x$coefficients[, c(4)])
AREA_p_Statistics_temp_w_Euler<-lapply(AREA_saved_p_w_Euler, function (x) x[c('CAT12Ratings')])
AREA_just_p_Statistics_w_Euler<-do.call(rbind.data.frame, AREA_p_Statistics_temp_w_Euler)
names(AREA_just_p_Statistics_w_Euler)[names(AREA_just_p_Statistics_w_Euler)=="c.0.128355058359466..0.1568892617196..0.449809620726687..0.475599157119494.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
AREA_just_p_Statistics_w_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_p_Statistics_w_Euler<-AREA_just_p_Statistics_w_Euler[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse);library(stats);library(gt);library(cowplot);library(dplyr)
dk_statistical_values_AREA_T_w_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(AREA_just_T_Statistics_w_Euler$T_stat[1],
AREA_just_T_Statistics_w_Euler$T_stat[2],
AREA_just_T_Statistics_w_Euler$T_stat[3],
AREA_just_T_Statistics_w_Euler$T_stat[4],
AREA_just_T_Statistics_w_Euler$T_stat[5],
AREA_just_T_Statistics_w_Euler$T_stat[6],
AREA_just_T_Statistics_w_Euler$T_stat[7],
AREA_just_T_Statistics_w_Euler$T_stat[8],
AREA_just_T_Statistics_w_Euler$T_stat[9],
AREA_just_T_Statistics_w_Euler$T_stat[10],
AREA_just_T_Statistics_w_Euler$T_stat[11],
AREA_just_T_Statistics_w_Euler$T_stat[12],
AREA_just_T_Statistics_w_Euler$T_stat[13],
AREA_just_T_Statistics_w_Euler$T_stat[14],
AREA_just_T_Statistics_w_Euler$T_stat[15],
AREA_just_T_Statistics_w_Euler$T_stat[16],
AREA_just_T_Statistics_w_Euler$T_stat[17],
AREA_just_T_Statistics_w_Euler$T_stat[18],
AREA_just_T_Statistics_w_Euler$T_stat[19],
AREA_just_T_Statistics_w_Euler$T_stat[20],
AREA_just_T_Statistics_w_Euler$T_stat[21],
AREA_just_T_Statistics_w_Euler$T_stat[22],
AREA_just_T_Statistics_w_Euler$T_stat[23],
AREA_just_T_Statistics_w_Euler$T_stat[24],
AREA_just_T_Statistics_w_Euler$T_stat[25],
AREA_just_T_Statistics_w_Euler$T_stat[26],
AREA_just_T_Statistics_w_Euler$T_stat[27],
AREA_just_T_Statistics_w_Euler$T_stat[28],
AREA_just_T_Statistics_w_Euler$T_stat[29],
AREA_just_T_Statistics_w_Euler$T_stat[30],
AREA_just_T_Statistics_w_Euler$T_stat[31],
AREA_just_T_Statistics_w_Euler$T_stat[32],
AREA_just_T_Statistics_w_Euler$T_stat[33],
AREA_just_T_Statistics_w_Euler$T_stat[34],
AREA_just_T_Statistics_w_Euler$T_stat[35],
AREA_just_T_Statistics_w_Euler$T_stat[36],
AREA_just_T_Statistics_w_Euler$T_stat[37],
AREA_just_T_Statistics_w_Euler$T_stat[38],
AREA_just_T_Statistics_w_Euler$T_stat[39],
AREA_just_T_Statistics_w_Euler$T_stat[40],
AREA_just_T_Statistics_w_Euler$T_stat[41],
AREA_just_T_Statistics_w_Euler$T_stat[42],
AREA_just_T_Statistics_w_Euler$T_stat[43],
AREA_just_T_Statistics_w_Euler$T_stat[44],
AREA_just_T_Statistics_w_Euler$T_stat[45],
AREA_just_T_Statistics_w_Euler$T_stat[46],
AREA_just_T_Statistics_w_Euler$T_stat[47],
AREA_just_T_Statistics_w_Euler$T_stat[48],
AREA_just_T_Statistics_w_Euler$T_stat[49],
AREA_just_T_Statistics_w_Euler$T_stat[50],
AREA_just_T_Statistics_w_Euler$T_stat[51],
AREA_just_T_Statistics_w_Euler$T_stat[52],
AREA_just_T_Statistics_w_Euler$T_stat[53],
AREA_just_T_Statistics_w_Euler$T_stat[54],
AREA_just_T_Statistics_w_Euler$T_stat[55],
AREA_just_T_Statistics_w_Euler$T_stat[56],
AREA_just_T_Statistics_w_Euler$T_stat[57],
AREA_just_T_Statistics_w_Euler$T_stat[58],
AREA_just_T_Statistics_w_Euler$T_stat[59],
AREA_just_T_Statistics_w_Euler$T_stat[60],
AREA_just_T_Statistics_w_Euler$T_stat[61],
AREA_just_T_Statistics_w_Euler$T_stat[62],
AREA_just_T_Statistics_w_Euler$T_stat[63],
AREA_just_T_Statistics_w_Euler$T_stat[64],
AREA_just_T_Statistics_w_Euler$T_stat[65],
AREA_just_T_Statistics_w_Euler$T_stat[66],
AREA_just_T_Statistics_w_Euler$T_stat[67],
AREA_just_T_Statistics_w_Euler$T_stat[68]))
dk_statistical_values_AREA_p_w_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(AREA_just_p_Statistics_w_Euler$pvalue[1],
AREA_just_p_Statistics_w_Euler$pvalue[2],
AREA_just_p_Statistics_w_Euler$pvalue[3],
AREA_just_p_Statistics_w_Euler$pvalue[4],
AREA_just_p_Statistics_w_Euler$pvalue[5],
AREA_just_p_Statistics_w_Euler$pvalue[6],
AREA_just_p_Statistics_w_Euler$pvalue[7],
AREA_just_p_Statistics_w_Euler$pvalue[8],
AREA_just_p_Statistics_w_Euler$pvalue[9],
AREA_just_p_Statistics_w_Euler$pvalue[10],
AREA_just_p_Statistics_w_Euler$pvalue[11],
AREA_just_p_Statistics_w_Euler$pvalue[12],
AREA_just_p_Statistics_w_Euler$pvalue[13],
AREA_just_p_Statistics_w_Euler$pvalue[14],
AREA_just_p_Statistics_w_Euler$pvalue[15],
AREA_just_p_Statistics_w_Euler$pvalue[16],
AREA_just_p_Statistics_w_Euler$pvalue[17],
AREA_just_p_Statistics_w_Euler$pvalue[18],
AREA_just_p_Statistics_w_Euler$pvalue[19],
AREA_just_p_Statistics_w_Euler$pvalue[20],
AREA_just_p_Statistics_w_Euler$pvalue[21],
AREA_just_p_Statistics_w_Euler$pvalue[22],
AREA_just_p_Statistics_w_Euler$pvalue[23],
AREA_just_p_Statistics_w_Euler$pvalue[24],
AREA_just_p_Statistics_w_Euler$pvalue[25],
AREA_just_p_Statistics_w_Euler$pvalue[26],
AREA_just_p_Statistics_w_Euler$pvalue[27],
AREA_just_p_Statistics_w_Euler$pvalue[28],
AREA_just_p_Statistics_w_Euler$pvalue[29],
AREA_just_p_Statistics_w_Euler$pvalue[30],
AREA_just_p_Statistics_w_Euler$pvalue[31],
AREA_just_p_Statistics_w_Euler$pvalue[32],
AREA_just_p_Statistics_w_Euler$pvalue[33],
AREA_just_p_Statistics_w_Euler$pvalue[34],
AREA_just_p_Statistics_w_Euler$pvalue[35],
AREA_just_p_Statistics_w_Euler$pvalue[36],
AREA_just_p_Statistics_w_Euler$pvalue[37],
AREA_just_p_Statistics_w_Euler$pvalue[38],
AREA_just_p_Statistics_w_Euler$pvalue[39],
AREA_just_p_Statistics_w_Euler$pvalue[40],
AREA_just_p_Statistics_w_Euler$pvalue[41],
AREA_just_p_Statistics_w_Euler$pvalue[42],
AREA_just_p_Statistics_w_Euler$pvalue[43],
AREA_just_p_Statistics_w_Euler$pvalue[44],
AREA_just_p_Statistics_w_Euler$pvalue[45],
AREA_just_p_Statistics_w_Euler$pvalue[46],
AREA_just_p_Statistics_w_Euler$pvalue[47],
AREA_just_p_Statistics_w_Euler$pvalue[48],
AREA_just_p_Statistics_w_Euler$pvalue[49],
AREA_just_p_Statistics_w_Euler$pvalue[50],
AREA_just_p_Statistics_w_Euler$pvalue[51],
AREA_just_p_Statistics_w_Euler$pvalue[52],
AREA_just_p_Statistics_w_Euler$pvalue[53],
AREA_just_p_Statistics_w_Euler$pvalue[54],
AREA_just_p_Statistics_w_Euler$pvalue[55],
AREA_just_p_Statistics_w_Euler$pvalue[56],
AREA_just_p_Statistics_w_Euler$pvalue[57],
AREA_just_p_Statistics_w_Euler$pvalue[58],
AREA_just_p_Statistics_w_Euler$pvalue[59],
AREA_just_p_Statistics_w_Euler$pvalue[60],
AREA_just_p_Statistics_w_Euler$pvalue[61],
AREA_just_p_Statistics_w_Euler$pvalue[62],
AREA_just_p_Statistics_w_Euler$pvalue[63],
AREA_just_p_Statistics_w_Euler$pvalue[64],
AREA_just_p_Statistics_w_Euler$pvalue[65],
AREA_just_p_Statistics_w_Euler$pvalue[66],
AREA_just_p_Statistics_w_Euler$pvalue[67],
AREA_just_p_Statistics_w_Euler$pvalue[68]))
Similar to above work, but now
making Figure S9 and
Table S4
library(stats)
# We correct for multiple comparisons with this call
dk_statistical_values_AREA_p_w_Euler$p_adjusted<-p.adjust(dk_statistical_values_AREA_p_w_Euler$p, method = "BH", n = length(dk_statistical_values_AREA_p_w_Euler$p))
# We combine some dataframes
dk_statistical_values_AREA_T_p_w_Euler <- dk_statistical_values_AREA_T_w_Euler %>% dplyr::left_join(dk_statistical_values_AREA_p_w_Euler)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
AREA_Multiple_Comparisons_w_Euler<-as_tibble(as.numeric(dk_statistical_values_AREA_T_p_w_Euler$p_adjusted<.05))
AREA_Multiple_Comparisons_w_Euler$value<-car::recode(AREA_Multiple_Comparisons_w_Euler$value, "0=NA")
names(AREA_Multiple_Comparisons_w_Euler)[names(AREA_Multiple_Comparisons_w_Euler)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_AREA_T_w_Euler_w_MultipleComparisons <- cbind(dk_statistical_values_AREA_T_w_Euler, AREA_Multiple_Comparisons_w_Euler)
# We make 2 figures (but store them)
AREA_p1_w_Euler<-ggseg(dk_statistical_values_AREA_T_w_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
AREA_p2_w_Euler<-ggseg(dk_statistical_values_AREA_T_w_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(AREA_p1_w_Euler, AREA_p2_w_Euler,labels = c('Area T-Statistics \nControlling for Euler Number', 'Survives Multiple \n Comparison Correction'))
Table S4
dk_statistical_values_AREA_T_p_w_Euler %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Area Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Area Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 1.52679 | 0.12836 | 0.26881 |
| lh_caudalanteriorcingulate | 1.42082 | 0.15689 | 0.29802 |
| lh_caudalmiddlefrontal | 0.75718 | 0.44981 | 0.58821 |
| lh_cuneus | -0.71471 | 0.47560 | 0.61020 |
| lh_entorhinal | 0.85650 | 0.39272 | 0.55156 |
| lh_fusiform | 0.26687 | 0.78983 | 0.83920 |
| lh_inferiorparietal | 0.51143 | 0.60960 | 0.71759 |
| lh_inferiortemporal | 2.81240 | 0.00540 | 0.06781 |
| lh_isthmuscingulate | 0.06992 | 0.94433 | 0.95842 |
| lh_lateraloccipital | -0.49290 | 0.62261 | 0.71759 |
| lh_lateralorbitofrontal | 2.72527 | 0.00698 | 0.06781 |
| lh_lingual | -1.08249 | 0.28030 | 0.44327 |
| lh_medialorbitofrontal | 1.97920 | 0.04913 | 0.21137 |
| lh_middletemporal | 1.87742 | 0.06188 | 0.21137 |
| lh_parahippocampal | 0.35661 | 0.72175 | 0.77903 |
| lh_paracentral | 0.83202 | 0.40637 | 0.55266 |
| lh_parsopercularis | 0.84796 | 0.39745 | 0.55156 |
| lh_parsorbitalis | 1.83213 | 0.06838 | 0.21137 |
| lh_parstriangularis | 1.63572 | 0.10343 | 0.24253 |
| lh_pericalcarine | -0.90776 | 0.36507 | 0.52819 |
| lh_postcentral | 0.96720 | 0.33458 | 0.49460 |
| lh_posteriorcingulate | 2.33469 | 0.02053 | 0.15509 |
| lh_precentral | -0.16131 | 0.87201 | 0.89843 |
| lh_precuneus | 1.38887 | 0.16638 | 0.29802 |
| lh_rostralanteriorcingulate | 1.86171 | 0.06408 | 0.21137 |
| lh_rostralmiddlefrontal | 3.08348 | 0.00233 | 0.04838 |
| lh_superiorfrontal | 1.41024 | 0.15999 | 0.29802 |
| lh_superiorparietal | 1.61195 | 0.10851 | 0.24596 |
| lh_superiortemporal | 1.96172 | 0.05115 | 0.21137 |
| lh_supramarginal | 1.80792 | 0.07209 | 0.21312 |
| lh_frontalpole | 2.11047 | 0.03603 | 0.19801 |
| lh_temporalpole | 1.97233 | 0.04992 | 0.21137 |
| lh_transversetemporal | 2.20674 | 0.02844 | 0.17582 |
| lh_insula | 1.86525 | 0.06358 | 0.21137 |
| rh_bankssts | 2.08995 | 0.03786 | 0.19801 |
| rh_caudalanteriorcingulate | 0.19262 | 0.84745 | 0.88656 |
| rh_caudalmiddlefrontal | 1.63974 | 0.10259 | 0.24253 |
| rh_cuneus | 0.44012 | 0.66031 | 0.73608 |
| rh_entorhinal | 1.65872 | 0.09870 | 0.24253 |
| rh_fusiform | 1.23891 | 0.21680 | 0.36855 |
| rh_inferiorparietal | 0.56404 | 0.57334 | 0.69620 |
| rh_inferiortemporal | 3.02037 | 0.00285 | 0.04838 |
| rh_isthmuscingulate | 0.47704 | 0.63384 | 0.71835 |
| rh_lateraloccipital | 0.36153 | 0.71807 | 0.77903 |
| rh_lateralorbitofrontal | 2.63430 | 0.00907 | 0.07713 |
| rh_lingual | -0.98685 | 0.32488 | 0.49093 |
| rh_medialorbitofrontal | 3.26222 | 0.00129 | 0.04838 |
| rh_middletemporal | 2.72604 | 0.00696 | 0.06781 |
| rh_parahippocampal | -0.79242 | 0.42903 | 0.57204 |
| rh_paracentral | 1.31858 | 0.18878 | 0.32916 |
| rh_parsopercularis | 0.50254 | 0.61583 | 0.71759 |
| rh_parsorbitalis | 1.84572 | 0.06638 | 0.21137 |
| rh_parstriangularis | 0.03834 | 0.96946 | 0.96946 |
| rh_pericalcarine | -0.63237 | 0.52785 | 0.65261 |
| rh_postcentral | 1.92463 | 0.05566 | 0.21137 |
| rh_posteriorcingulate | 1.66839 | 0.09677 | 0.24253 |
| rh_precentral | 1.14721 | 0.25263 | 0.41773 |
| rh_precuneus | 1.56505 | 0.11911 | 0.26128 |
| rh_rostralanteriorcingulate | 0.64170 | 0.52178 | 0.65261 |
| rh_rostralmiddlefrontal | 1.72545 | 0.08595 | 0.23379 |
| rh_superiorfrontal | 1.51842 | 0.13045 | 0.26881 |
| rh_superiorparietal | 0.98930 | 0.32369 | 0.49093 |
| rh_superiortemporal | 2.28680 | 0.02323 | 0.15796 |
| rh_supramarginal | 3.09288 | 0.00226 | 0.04838 |
| rh_frontalpole | 1.38834 | 0.16654 | 0.29802 |
| rh_temporalpole | 1.13426 | 0.25801 | 0.41773 |
| rh_transversetemporal | 1.48843 | 0.13817 | 0.27635 |
| rh_insula | 1.73069 | 0.08501 | 0.23379 |
Descriptive Statistics about t-values for Area
And MRI Quality (controlling for Euler number)
range(dk_statistical_values_AREA_T_p_w_Euler$t)
## [1] -1.082494 3.262218
mean(dk_statistical_values_AREA_T_p_w_Euler$t)
## [1] 1.256357
sd(dk_statistical_values_AREA_T_p_w_Euler$t)
## [1] 1.060873
table(dk_statistical_values_AREA_T_p_w_Euler$p>.05)
##
## FALSE TRUE
## 15 53
table(is.na(AREA_Multiple_Comparisons_w_Euler))
##
## FALSE TRUE
## 4 64
We now do the same thing for cortical thickness
[ Same tibbling and regression loops, etc.]
Figure S9
OnlySubsPassingVisualQC_Freesurfer_THICKNESS<-OnlySubsPassingVisualQC[,149:217]
OnlySubsPassingVisualQC_Freesurfer_THICKNESS<-OnlySubsPassingVisualQC_Freesurfer_THICKNESS %>% dplyr::select(-c(lh_MeanThickness_thickness))
OnlySubsPassingVisualQC_Freesurfer_THICKNESS$CAT12_QC_Weighted_Average<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
## Add Age and QC "back in"
THICKNESS_for_Figure<-OnlySubsPassingVisualQC_Freesurfer_THICKNESS[,1:68]
CAT12Ratings<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Euler<-OnlySubsPassingVisualQC$SurfaceHoles
## Regression Loop, with Thickness as DV and Age & QC as IVs
n<-68
THICKNESS_Loop_to_Extract_Tstats_w_Euler <- lapply(1:n, function(x) lm(THICKNESS_for_Figure[,x] ~ Euler + CAT12Ratings))
#Pulling out t-statistics, etc.
THICKNESS_summaries_w_Euler <- lapply(THICKNESS_Loop_to_Extract_Tstats_w_Euler, summary)
THICKNESS_saved_T_w_Euler<-lapply(THICKNESS_summaries_w_Euler, function(x) x$coefficients[, c(3)])
THICKNESS_T_Statistics_temp_w_Euler<-lapply(THICKNESS_saved_T_w_Euler, function (x) x[c('CAT12Ratings')])
THICKNESS_just_T_Statistics_w_Euler<-do.call(rbind.data.frame, THICKNESS_T_Statistics_temp_w_Euler)
names(THICKNESS_just_T_Statistics_w_Euler)[names(THICKNESS_just_T_Statistics_w_Euler)=="c.2.37676779352531...1.57112214767383..5.31168444803598..1.14201184485855.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
THICKNESS_just_T_Statistics_w_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_T_Statistics_w_Euler<-THICKNESS_just_T_Statistics_w_Euler[, c(2,1)]
## Pull out P-Values from Regressions
THICKNESS_saved_p_w_Euler<-lapply(THICKNESS_summaries_w_Euler, function(x) x$coefficients[, c(4)])
THICKNESS_p_Statistics_temp_w_Euler<-lapply(THICKNESS_saved_p_w_Euler, function (x) x[c('CAT12Ratings')])
THICKNESS_just_p_Statistics_w_Euler<-do.call(rbind.data.frame, THICKNESS_p_Statistics_temp_w_Euler)
names(THICKNESS_just_p_Statistics_w_Euler)[names(THICKNESS_just_p_Statistics_w_Euler)=="c.0.0183853999737464..0.117696427703176..2.81837423014638e.07.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
THICKNESS_just_p_Statistics_w_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_p_Statistics_w_Euler<-THICKNESS_just_p_Statistics_w_Euler[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse);library(stats);library(gt);library(cowplot);library(dplyr)
dk_statistical_values_THICKNESS_T_w_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(THICKNESS_just_T_Statistics_w_Euler$T_stat[1],
THICKNESS_just_T_Statistics_w_Euler$T_stat[2],
THICKNESS_just_T_Statistics_w_Euler$T_stat[3],
THICKNESS_just_T_Statistics_w_Euler$T_stat[4],
THICKNESS_just_T_Statistics_w_Euler$T_stat[5],
THICKNESS_just_T_Statistics_w_Euler$T_stat[6],
THICKNESS_just_T_Statistics_w_Euler$T_stat[7],
THICKNESS_just_T_Statistics_w_Euler$T_stat[8],
THICKNESS_just_T_Statistics_w_Euler$T_stat[9],
THICKNESS_just_T_Statistics_w_Euler$T_stat[10],
THICKNESS_just_T_Statistics_w_Euler$T_stat[11],
THICKNESS_just_T_Statistics_w_Euler$T_stat[12],
THICKNESS_just_T_Statistics_w_Euler$T_stat[13],
THICKNESS_just_T_Statistics_w_Euler$T_stat[14],
THICKNESS_just_T_Statistics_w_Euler$T_stat[15],
THICKNESS_just_T_Statistics_w_Euler$T_stat[16],
THICKNESS_just_T_Statistics_w_Euler$T_stat[17],
THICKNESS_just_T_Statistics_w_Euler$T_stat[18],
THICKNESS_just_T_Statistics_w_Euler$T_stat[19],
THICKNESS_just_T_Statistics_w_Euler$T_stat[20],
THICKNESS_just_T_Statistics_w_Euler$T_stat[21],
THICKNESS_just_T_Statistics_w_Euler$T_stat[22],
THICKNESS_just_T_Statistics_w_Euler$T_stat[23],
THICKNESS_just_T_Statistics_w_Euler$T_stat[24],
THICKNESS_just_T_Statistics_w_Euler$T_stat[25],
THICKNESS_just_T_Statistics_w_Euler$T_stat[26],
THICKNESS_just_T_Statistics_w_Euler$T_stat[27],
THICKNESS_just_T_Statistics_w_Euler$T_stat[28],
THICKNESS_just_T_Statistics_w_Euler$T_stat[29],
THICKNESS_just_T_Statistics_w_Euler$T_stat[30],
THICKNESS_just_T_Statistics_w_Euler$T_stat[31],
THICKNESS_just_T_Statistics_w_Euler$T_stat[32],
THICKNESS_just_T_Statistics_w_Euler$T_stat[33],
THICKNESS_just_T_Statistics_w_Euler$T_stat[34],
THICKNESS_just_T_Statistics_w_Euler$T_stat[35],
THICKNESS_just_T_Statistics_w_Euler$T_stat[36],
THICKNESS_just_T_Statistics_w_Euler$T_stat[37],
THICKNESS_just_T_Statistics_w_Euler$T_stat[38],
THICKNESS_just_T_Statistics_w_Euler$T_stat[39],
THICKNESS_just_T_Statistics_w_Euler$T_stat[40],
THICKNESS_just_T_Statistics_w_Euler$T_stat[41],
THICKNESS_just_T_Statistics_w_Euler$T_stat[42],
THICKNESS_just_T_Statistics_w_Euler$T_stat[43],
THICKNESS_just_T_Statistics_w_Euler$T_stat[44],
THICKNESS_just_T_Statistics_w_Euler$T_stat[45],
THICKNESS_just_T_Statistics_w_Euler$T_stat[46],
THICKNESS_just_T_Statistics_w_Euler$T_stat[47],
THICKNESS_just_T_Statistics_w_Euler$T_stat[48],
THICKNESS_just_T_Statistics_w_Euler$T_stat[49],
THICKNESS_just_T_Statistics_w_Euler$T_stat[50],
THICKNESS_just_T_Statistics_w_Euler$T_stat[51],
THICKNESS_just_T_Statistics_w_Euler$T_stat[52],
THICKNESS_just_T_Statistics_w_Euler$T_stat[53],
THICKNESS_just_T_Statistics_w_Euler$T_stat[54],
THICKNESS_just_T_Statistics_w_Euler$T_stat[55],
THICKNESS_just_T_Statistics_w_Euler$T_stat[56],
THICKNESS_just_T_Statistics_w_Euler$T_stat[57],
THICKNESS_just_T_Statistics_w_Euler$T_stat[58],
THICKNESS_just_T_Statistics_w_Euler$T_stat[59],
THICKNESS_just_T_Statistics_w_Euler$T_stat[60],
THICKNESS_just_T_Statistics_w_Euler$T_stat[61],
THICKNESS_just_T_Statistics_w_Euler$T_stat[62],
THICKNESS_just_T_Statistics_w_Euler$T_stat[63],
THICKNESS_just_T_Statistics_w_Euler$T_stat[64],
THICKNESS_just_T_Statistics_w_Euler$T_stat[65],
THICKNESS_just_T_Statistics_w_Euler$T_stat[66],
THICKNESS_just_T_Statistics_w_Euler$T_stat[67],
THICKNESS_just_T_Statistics_w_Euler$T_stat[68]))
dk_statistical_values_THICKNESS_p_w_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(THICKNESS_just_p_Statistics_w_Euler$pvalue[1],
THICKNESS_just_p_Statistics_w_Euler$pvalue[2],
THICKNESS_just_p_Statistics_w_Euler$pvalue[3],
THICKNESS_just_p_Statistics_w_Euler$pvalue[4],
THICKNESS_just_p_Statistics_w_Euler$pvalue[5],
THICKNESS_just_p_Statistics_w_Euler$pvalue[6],
THICKNESS_just_p_Statistics_w_Euler$pvalue[7],
THICKNESS_just_p_Statistics_w_Euler$pvalue[8],
THICKNESS_just_p_Statistics_w_Euler$pvalue[9],
THICKNESS_just_p_Statistics_w_Euler$pvalue[10],
THICKNESS_just_p_Statistics_w_Euler$pvalue[11],
THICKNESS_just_p_Statistics_w_Euler$pvalue[12],
THICKNESS_just_p_Statistics_w_Euler$pvalue[13],
THICKNESS_just_p_Statistics_w_Euler$pvalue[14],
THICKNESS_just_p_Statistics_w_Euler$pvalue[15],
THICKNESS_just_p_Statistics_w_Euler$pvalue[16],
THICKNESS_just_p_Statistics_w_Euler$pvalue[17],
THICKNESS_just_p_Statistics_w_Euler$pvalue[18],
THICKNESS_just_p_Statistics_w_Euler$pvalue[19],
THICKNESS_just_p_Statistics_w_Euler$pvalue[20],
THICKNESS_just_p_Statistics_w_Euler$pvalue[21],
THICKNESS_just_p_Statistics_w_Euler$pvalue[22],
THICKNESS_just_p_Statistics_w_Euler$pvalue[23],
THICKNESS_just_p_Statistics_w_Euler$pvalue[24],
THICKNESS_just_p_Statistics_w_Euler$pvalue[25],
THICKNESS_just_p_Statistics_w_Euler$pvalue[26],
THICKNESS_just_p_Statistics_w_Euler$pvalue[27],
THICKNESS_just_p_Statistics_w_Euler$pvalue[28],
THICKNESS_just_p_Statistics_w_Euler$pvalue[29],
THICKNESS_just_p_Statistics_w_Euler$pvalue[30],
THICKNESS_just_p_Statistics_w_Euler$pvalue[31],
THICKNESS_just_p_Statistics_w_Euler$pvalue[32],
THICKNESS_just_p_Statistics_w_Euler$pvalue[33],
THICKNESS_just_p_Statistics_w_Euler$pvalue[34],
THICKNESS_just_p_Statistics_w_Euler$pvalue[35],
THICKNESS_just_p_Statistics_w_Euler$pvalue[36],
THICKNESS_just_p_Statistics_w_Euler$pvalue[37],
THICKNESS_just_p_Statistics_w_Euler$pvalue[38],
THICKNESS_just_p_Statistics_w_Euler$pvalue[39],
THICKNESS_just_p_Statistics_w_Euler$pvalue[40],
THICKNESS_just_p_Statistics_w_Euler$pvalue[41],
THICKNESS_just_p_Statistics_w_Euler$pvalue[42],
THICKNESS_just_p_Statistics_w_Euler$pvalue[43],
THICKNESS_just_p_Statistics_w_Euler$pvalue[44],
THICKNESS_just_p_Statistics_w_Euler$pvalue[45],
THICKNESS_just_p_Statistics_w_Euler$pvalue[46],
THICKNESS_just_p_Statistics_w_Euler$pvalue[47],
THICKNESS_just_p_Statistics_w_Euler$pvalue[48],
THICKNESS_just_p_Statistics_w_Euler$pvalue[49],
THICKNESS_just_p_Statistics_w_Euler$pvalue[50],
THICKNESS_just_p_Statistics_w_Euler$pvalue[51],
THICKNESS_just_p_Statistics_w_Euler$pvalue[52],
THICKNESS_just_p_Statistics_w_Euler$pvalue[53],
THICKNESS_just_p_Statistics_w_Euler$pvalue[54],
THICKNESS_just_p_Statistics_w_Euler$pvalue[55],
THICKNESS_just_p_Statistics_w_Euler$pvalue[56],
THICKNESS_just_p_Statistics_w_Euler$pvalue[57],
THICKNESS_just_p_Statistics_w_Euler$pvalue[58],
THICKNESS_just_p_Statistics_w_Euler$pvalue[59],
THICKNESS_just_p_Statistics_w_Euler$pvalue[60],
THICKNESS_just_p_Statistics_w_Euler$pvalue[61],
THICKNESS_just_p_Statistics_w_Euler$pvalue[62],
THICKNESS_just_p_Statistics_w_Euler$pvalue[63],
THICKNESS_just_p_Statistics_w_Euler$pvalue[64],
THICKNESS_just_p_Statistics_w_Euler$pvalue[65],
THICKNESS_just_p_Statistics_w_Euler$pvalue[66],
THICKNESS_just_p_Statistics_w_Euler$pvalue[67],
THICKNESS_just_p_Statistics_w_Euler$pvalue[68]))
Making Figure S9
And deal with multiple comparisons
# We correct for multiple comparisons with this call
dk_statistical_values_THICKNESS_p_w_Euler$p_adjusted<-p.adjust(dk_statistical_values_THICKNESS_p_w_Euler$p, method = "BH", n = length(dk_statistical_values_THICKNESS_p_w_Euler$p))
# We combine some dataframes
dk_statistical_values_THICKNESS_T_p_w_Euler <- dk_statistical_values_THICKNESS_T_w_Euler %>% left_join(dk_statistical_values_THICKNESS_p_w_Euler)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
THICKNESS_Multiple_Comparisons_w_Euler<-as_tibble(as.numeric(dk_statistical_values_THICKNESS_T_p_w_Euler$p_adjusted<.05))
THICKNESS_Multiple_Comparisons_w_Euler$value<-car::recode(THICKNESS_Multiple_Comparisons_w_Euler$value, "0=NA")
names(THICKNESS_Multiple_Comparisons_w_Euler)[names(THICKNESS_Multiple_Comparisons_w_Euler)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_THICKNESS_T_w_Euler_w_MultipleComparisons <- cbind(dk_statistical_values_THICKNESS_T_w_Euler, THICKNESS_Multiple_Comparisons_w_Euler)
# We make 2 figures (but store them)
THICKNESS_p1_w_Euler<-ggseg(dk_statistical_values_THICKNESS_T_w_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
THICKNESS_p2_w_Euler<-ggseg(dk_statistical_values_THICKNESS_T_w_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(THICKNESS_p1_w_Euler, THICKNESS_p2_w_Euler,labels = c('THICKNESS T-Statistics \nControlling for Euler Number', 'Survives Multiple \n Comparison Correction'))
Table S4
dk_statistical_values_THICKNESS_T_p_w_Euler %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('THICKNESS Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| THICKNESS Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 2.37677 | 0.01839 | 0.03126 |
| lh_caudalanteriorcingulate | -1.57112 | 0.11770 | 0.16333 |
| lh_caudalmiddlefrontal | 5.31168 | 0.00000 | 0.00001 |
| lh_cuneus | 1.14201 | 0.25478 | 0.31500 |
| lh_entorhinal | 3.60223 | 0.00040 | 0.00112 |
| lh_fusiform | 3.90558 | 0.00013 | 0.00054 |
| lh_inferiorparietal | 4.89810 | 0.00000 | 0.00002 |
| lh_inferiortemporal | 5.07562 | 0.00000 | 0.00001 |
| lh_isthmuscingulate | 1.08901 | 0.27743 | 0.33097 |
| lh_lateraloccipital | 3.15017 | 0.00188 | 0.00411 |
| lh_lateralorbitofrontal | 5.03301 | 0.00000 | 0.00001 |
| lh_lingual | 1.00507 | 0.31605 | 0.35842 |
| lh_medialorbitofrontal | 1.87564 | 0.06213 | 0.09388 |
| lh_middletemporal | 2.33412 | 0.02056 | 0.03328 |
| lh_parahippocampal | 0.95046 | 0.34300 | 0.37619 |
| lh_paracentral | 2.81875 | 0.00529 | 0.01000 |
| lh_parsopercularis | 3.83335 | 0.00017 | 0.00067 |
| lh_parsorbitalis | 3.32221 | 0.00106 | 0.00248 |
| lh_parstriangularis | 2.94189 | 0.00364 | 0.00726 |
| lh_pericalcarine | -0.52556 | 0.59976 | 0.60871 |
| lh_postcentral | 1.66368 | 0.09770 | 0.14136 |
| lh_posteriorcingulate | 1.31353 | 0.19047 | 0.24438 |
| lh_precentral | 5.80566 | 0.00000 | 0.00000 |
| lh_precuneus | 2.33951 | 0.02027 | 0.03328 |
| lh_rostralanteriorcingulate | -0.85321 | 0.39454 | 0.41920 |
| lh_rostralmiddlefrontal | 3.12976 | 0.00200 | 0.00418 |
| lh_superiorfrontal | 4.11252 | 0.00006 | 0.00026 |
| lh_superiorparietal | 4.35311 | 0.00002 | 0.00012 |
| lh_superiortemporal | 3.46448 | 0.00065 | 0.00166 |
| lh_supramarginal | 3.60319 | 0.00039 | 0.00112 |
| lh_frontalpole | 1.07221 | 0.28489 | 0.33400 |
| lh_temporalpole | 4.60102 | 0.00001 | 0.00005 |
| lh_transversetemporal | 0.79434 | 0.42791 | 0.44602 |
| lh_insula | 0.95833 | 0.33902 | 0.37619 |
| rh_bankssts | 3.65218 | 0.00033 | 0.00102 |
| rh_caudalanteriorcingulate | -0.01454 | 0.98841 | 0.98841 |
| rh_caudalmiddlefrontal | 5.34228 | 0.00000 | 0.00001 |
| rh_cuneus | 2.00791 | 0.04597 | 0.07104 |
| rh_entorhinal | 3.12598 | 0.00203 | 0.00418 |
| rh_fusiform | 3.47769 | 0.00062 | 0.00166 |
| rh_inferiorparietal | 2.57995 | 0.01058 | 0.01893 |
| rh_inferiortemporal | 4.73156 | 0.00000 | 0.00004 |
| rh_isthmuscingulate | -0.78579 | 0.43290 | 0.44602 |
| rh_lateraloccipital | 3.77164 | 0.00021 | 0.00078 |
| rh_lateralorbitofrontal | 4.38877 | 0.00002 | 0.00011 |
| rh_lingual | 1.12870 | 0.26034 | 0.31613 |
| rh_medialorbitofrontal | 1.82305 | 0.06975 | 0.10311 |
| rh_middletemporal | 3.16018 | 0.00182 | 0.00411 |
| rh_parahippocampal | 1.63283 | 0.10404 | 0.14739 |
| rh_paracentral | 4.21631 | 0.00004 | 0.00019 |
| rh_parsopercularis | 4.20895 | 0.00004 | 0.00019 |
| rh_parsorbitalis | 3.76019 | 0.00022 | 0.00078 |
| rh_parstriangularis | 3.75070 | 0.00023 | 0.00078 |
| rh_pericalcarine | 1.24274 | 0.21538 | 0.27122 |
| rh_postcentral | 1.00464 | 0.31625 | 0.35842 |
| rh_posteriorcingulate | 1.48136 | 0.14005 | 0.19046 |
| rh_precentral | 5.18980 | 0.00000 | 0.00001 |
| rh_precuneus | 2.45685 | 0.01485 | 0.02589 |
| rh_rostralanteriorcingulate | 1.32617 | 0.18626 | 0.24357 |
| rh_rostralmiddlefrontal | 3.37729 | 0.00088 | 0.00213 |
| rh_superiorfrontal | 3.68648 | 0.00029 | 0.00094 |
| rh_superiorparietal | 4.68648 | 0.00001 | 0.00004 |
| rh_superiortemporal | 2.75673 | 0.00636 | 0.01170 |
| rh_supramarginal | 2.93312 | 0.00374 | 0.00726 |
| rh_frontalpole | 1.34861 | 0.17895 | 0.23860 |
| rh_temporalpole | 3.45833 | 0.00066 | 0.00166 |
| rh_transversetemporal | 2.15148 | 0.03261 | 0.05157 |
| rh_insula | 0.91500 | 0.36127 | 0.38994 |
Descriptive Statistics about t-values for Thickness
And MRI Quality (controlling for Euler number)
range(dk_statistical_values_THICKNESS_T_p_w_Euler$t)
## [1] -1.571122 5.805655
mean(dk_statistical_values_THICKNESS_T_p_w_Euler$t)
## [1] 2.689717
sd(dk_statistical_values_THICKNESS_T_p_w_Euler$t)
## [1] 1.667357
table(dk_statistical_values_THICKNESS_T_p_w_Euler$p>.05)
##
## FALSE TRUE
## 44 24
table(is.na(THICKNESS_Multiple_Comparisons_w_Euler))
##
## FALSE TRUE
## 42 26
Final set of loops and data organization
This final time for the subcortical volumes
[ Same tibbling and regression loops, etc.]
Figure S10
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC[,14:58]
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC_Freesurfer_ASEG %>% dplyr::select(-c(Left.Cerebellum.White.Matter, Left.Cerebellum.Cortex, Left.Lateral.Ventricle,Left.Inf.Lat.Vent,X3rd.Ventricle,X4th.Ventricle,CSF,Left.vessel,Left.choroid.plexus,Right.Cerebellum.White.Matter,Right.Cerebellum.Cortex,Right.Lateral.Ventricle,Right.Inf.Lat.Vent,Right.vessel,Right.choroid.plexus,X5th.Ventricle,WM.hypointensities,Left.WM.hypointensities,Right.WM.hypointensities,non.WM.hypointensities,Left.non.WM.hypointensities,Right.non.WM.hypointensities,Optic.Chiasm))
CAT12Ratings<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Euler<-OnlySubsPassingVisualQC$SurfaceHoles
## Regression Loop, with Aseg as DV and Age & QC as IVs
n<-22
ASEG_Loop_to_Extract_Tstats_w_Euler <- lapply(1:n, function(x) lm(OnlySubsPassingVisualQC_Freesurfer_ASEG[,x] ~ Euler + CAT12Ratings))
## Pull out T-Statistics from Regressions
ASEG_summaries_w_Euler <- lapply(ASEG_Loop_to_Extract_Tstats_w_Euler, summary)
ASEG_saved_T_w_Euler<-lapply(ASEG_summaries_w_Euler, function(x) x$coefficients[, c(3)])
ASEG_T_Statistics_temp_w_Euler<-lapply(ASEG_saved_T_w_Euler, function (x) x[c('CAT12Ratings')])
ASEG_just_T_Statistics_w_Euler<-do.call(rbind.data.frame, ASEG_T_Statistics_temp_w_Euler)
names(ASEG_just_T_Statistics_w_Euler)[names(ASEG_just_T_Statistics_w_Euler)=="c..0.645886240305663..0.277457263723445..0.96491661876235..0.234481831698497.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
ASEG_just_T_Statistics_w_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_T_Statistics_w_Euler<-ASEG_just_T_Statistics_w_Euler[, c(2,1)]
## Pull out P-Values from Regressions
ASEG_saved_p_w_Euler<-lapply(ASEG_summaries_w_Euler, function(x) x$coefficients[, c(4)])
ASEG_p_Statistics_temp_w_Euler<-lapply(ASEG_saved_p_w_Euler, function (x) x[c('CAT12Ratings')])
ASEG_just_p_Statistics_w_Euler<-do.call(rbind.data.frame, ASEG_p_Statistics_temp_w_Euler)
names(ASEG_just_p_Statistics_w_Euler)[names(ASEG_just_p_Statistics_w_Euler)=="c.0.519075362598068..0.781708613412818..0.335723463694187..0.814844962134579.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
ASEG_just_p_Statistics_w_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_p_Statistics_w_Euler<-ASEG_just_p_Statistics_w_Euler[, c(2,1)]
# Make tibble to eventually put into ggseg [for t-statistics]
aseg_statistical_values_T_w_Euler= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
t=c(ASEG_just_T_Statistics_w_Euler$T_stat[1],
ASEG_just_T_Statistics_w_Euler$T_stat[2],
ASEG_just_T_Statistics_w_Euler$T_stat[3],
ASEG_just_T_Statistics_w_Euler$T_stat[4],
ASEG_just_T_Statistics_w_Euler$T_stat[5],
ASEG_just_T_Statistics_w_Euler$T_stat[6],
ASEG_just_T_Statistics_w_Euler$T_stat[7],
ASEG_just_T_Statistics_w_Euler$T_stat[8],
ASEG_just_T_Statistics_w_Euler$T_stat[9],
ASEG_just_T_Statistics_w_Euler$T_stat[10],
ASEG_just_T_Statistics_w_Euler$T_stat[11],
ASEG_just_T_Statistics_w_Euler$T_stat[12],
ASEG_just_T_Statistics_w_Euler$T_stat[13],
ASEG_just_T_Statistics_w_Euler$T_stat[14],
ASEG_just_T_Statistics_w_Euler$T_stat[15],
ASEG_just_T_Statistics_w_Euler$T_stat[16],
ASEG_just_T_Statistics_w_Euler$T_stat[17],
ASEG_just_T_Statistics_w_Euler$T_stat[18],
ASEG_just_T_Statistics_w_Euler$T_stat[19],
ASEG_just_T_Statistics_w_Euler$T_stat[20],
ASEG_just_T_Statistics_w_Euler$T_stat[21],
ASEG_just_T_Statistics_w_Euler$T_stat[22]))
# Make tibble to eventually put into ggseg [for p-values]
aseg_statistical_values_p_w_Euler= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
p=c(ASEG_just_p_Statistics_w_Euler$pvalue[1],
ASEG_just_p_Statistics_w_Euler$pvalue[2],
ASEG_just_p_Statistics_w_Euler$pvalue[3],
ASEG_just_p_Statistics_w_Euler$pvalue[4],
ASEG_just_p_Statistics_w_Euler$pvalue[5],
ASEG_just_p_Statistics_w_Euler$pvalue[6],
ASEG_just_p_Statistics_w_Euler$pvalue[7],
ASEG_just_p_Statistics_w_Euler$pvalue[8],
ASEG_just_p_Statistics_w_Euler$pvalue[9],
ASEG_just_p_Statistics_w_Euler$pvalue[10],
ASEG_just_p_Statistics_w_Euler$pvalue[11],
ASEG_just_p_Statistics_w_Euler$pvalue[12],
ASEG_just_p_Statistics_w_Euler$pvalue[13],
ASEG_just_p_Statistics_w_Euler$pvalue[14],
ASEG_just_p_Statistics_w_Euler$pvalue[15],
ASEG_just_p_Statistics_w_Euler$pvalue[16],
ASEG_just_p_Statistics_w_Euler$pvalue[17],
ASEG_just_p_Statistics_w_Euler$pvalue[18],
ASEG_just_p_Statistics_w_Euler$pvalue[19],
ASEG_just_p_Statistics_w_Euler$pvalue[20],
ASEG_just_p_Statistics_w_Euler$pvalue[21],
ASEG_just_p_Statistics_w_Euler$pvalue[22]))
# Multiple Comparison Correction
aseg_statistical_values_p_w_Euler$p_adjusted<-p.adjust(aseg_statistical_values_p_w_Euler$p, method = "BH", n = length(aseg_statistical_values_p_w_Euler$p))
aseg_statistical_values_T_p_w_Euler <- aseg_statistical_values_T_w_Euler %>% left_join(aseg_statistical_values_p_w_Euler)
## Joining, by = "label"
Aseg_Multiple_Comparisons_w_Euler<-as_tibble(as.numeric(aseg_statistical_values_T_p_w_Euler$p_adjusted<.05))
Aseg_Multiple_Comparisons_w_Euler$value<-car::recode(Aseg_Multiple_Comparisons_w_Euler$value, "0=NA")
names(Aseg_Multiple_Comparisons_w_Euler)[names(Aseg_Multiple_Comparisons_w_Euler)=="value"] <- "Survives_Multiple_Comparison_Correction"
aseg_statistical_values_T_w_MultipleComparisons_w_Euler <- cbind(aseg_statistical_values_T_w_Euler, Aseg_Multiple_Comparisons_w_Euler)
aseg_p1_w_Euler<-ggseg(aseg_statistical_values_T_w_Euler,atlas=aseg,position = "stacked",mapping=aes(fill=t,color=Survives_Multiple_Comparison_Correction),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75))+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbens-area 0.204
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumbens-area 1.67
aseg_p2_w_Euler<-ggseg(aseg_statistical_values_T_w_MultipleComparisons_w_Euler,atlas=aseg,position = "stacked",mapping=aes(fill=Survives_Multiple_Comparison_Correction),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t Survives_Multiple_Comparis…
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbe… 0.204 NA
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumb… 1.67 NA
plot_grid(aseg_p1_w_Euler, aseg_p2_w_Euler,labels = c('Subcortical Volumes \nT-Statistics Controlling \nfor Euler Number', 'Survives Multiple \n Comparison Correction'))
Again, we also output a Table showing the stats for
QC and aseg volumes
with adjusted and unadjusted p-values
For the folks who like tables, etc.
Table 4
aseg_statistical_values_T_p_w_Euler %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Aseg_Volume' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Aseg_Volume | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| Left-Thalamus-Proper | -0.64589 | 0.51908 | 0.86071 |
| Left-Caudate | 0.27746 | 0.78171 | 0.95251 |
| Left-Putamen | 0.96492 | 0.33572 | 0.86071 |
| Left-Pallidum | 0.23448 | 0.81484 | 0.95251 |
| brain-stem | -0.26932 | 0.78795 | 0.95251 |
| Left-Hippocampus | 0.60217 | 0.54772 | 0.86071 |
| Left-Amygdala | 2.73222 | 0.00684 | 0.15048 |
| Left-Accumbens-area | 0.20435 | 0.83828 | 0.95251 |
| Left-VentralDC | -0.43247 | 0.66585 | 0.95251 |
| Right-Thalamus-Proper | -0.67981 | 0.49739 | 0.86071 |
| Right-Caudate | 0.04714 | 0.96245 | 0.96245 |
| Right-Putamen | 1.34128 | 0.18131 | 0.86071 |
| Right-Pallidum | 0.93608 | 0.35033 | 0.86071 |
| Right-Hippocampus | 0.71709 | 0.47413 | 0.86071 |
| Right-Amygdala | 1.76543 | 0.07898 | 0.70335 |
| Right-Accumbens-area | 1.67270 | 0.09591 | 0.70335 |
| Right-VentralDC | 0.06113 | 0.95131 | 0.96245 |
| cc-posterior | 1.17391 | 0.24179 | 0.86071 |
| cc-mid-posterior | 0.71238 | 0.47704 | 0.86071 |
| cc-central | 0.16906 | 0.86592 | 0.95251 |
| cc-mid-anterior | 0.96659 | 0.33489 | 0.86071 |
| cc-anterior | 0.79730 | 0.42620 | 0.86071 |
range(aseg_statistical_values_T_p_w_Euler$t)
## [1] -0.6798057 2.7322208
mean(aseg_statistical_values_T_p_w_Euler$t)
## [1] 0.6067366
sd(aseg_statistical_values_T_p_w_Euler$t)
## [1] 0.8328579
table(aseg_statistical_values_T_p_w_Euler$p>.05)
##
## FALSE TRUE
## 1 21
table(is.na(Aseg_Multiple_Comparisons_w_Euler))
##
## TRUE
## 22
For S6. Association Between CAT12 Scan Rating and Freesurfer Outputs, Only Examining Participants Excluded After Visual Quality Control by Raters Work on the original “combined” dataset,
but select subjects who were excluded (==0)
combined<-read.csv("HBN_combined_2021_03_04_full.csv")
combined<-subset(combined,combined$CAT12_QC_Weighted_Average!="NA")
SubsNOTPassingVisualQC<-subset(combined,combined$passing==0)
Similar code to the main manuscript
But for excluded subjects
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
## Supplement S1: Correlations Between Area and QC, partially out Age
## Rework data to include Freesurfer Area Volumes
SubsNOTPassingVisualQC_Freesurfer_AREA<-SubsNOTPassingVisualQC[,78:147]
SubsNOTPassingVisualQC_Freesurfer_AREA<-SubsNOTPassingVisualQC_Freesurfer_AREA %>% dplyr::select(-c(lh_WhiteSurfArea_area,eTIV))
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
## ## ## ## Analyses for Cortical Surface Area ## ## ## ##
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
## Add Age and QC "back in"
SubsNOTPassingVisualQC_Freesurfer_AREA$CAT12_QC_Weighted_Average<-SubsNOTPassingVisualQC$CAT12_QC_Weighted_Average
AREA_for_Figure_VisualQCFAIL<-SubsNOTPassingVisualQC_Freesurfer_AREA[,1:68]
CAT12Ratings<-SubsNOTPassingVisualQC_Freesurfer_AREA[,69]
## Regression Loop, with Area as DV and Age & QC as IVs
n<-68
AREA_Loop_to_Extract_Tstats_VisualQCFAIL <- lapply(1:n, function(x) lm(AREA_for_Figure_VisualQCFAIL[,x] ~ CAT12Ratings))
## Pull out T-Statistics from Regressions
AREA_summaries_VisualQCFAIL <- lapply(AREA_Loop_to_Extract_Tstats_VisualQCFAIL, summary)
AREA_saved_T_VisualQCFAIL<-lapply(AREA_summaries_VisualQCFAIL, function(x) x$coefficients[, c(3)])
AREA_T_Statistics_temp_VisualQCFAIL<-lapply(AREA_saved_T_VisualQCFAIL, function (x) x[c('CAT12Ratings')])
AREA_just_T_Statistics_VisualQCFAIL<-do.call(rbind.data.frame, AREA_T_Statistics_temp_VisualQCFAIL)
names(AREA_just_T_Statistics_VisualQCFAIL)[names(AREA_just_T_Statistics_VisualQCFAIL)=="c.10.1034687342453..6.53239238377987..9.58916678201741..10.8648239499514.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
AREA_just_T_Statistics_VisualQCFAIL$BrainRegions<-(colnames(SubsNOTPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_T_Statistics_VisualQCFAIL<-AREA_just_T_Statistics_VisualQCFAIL[, c(2,1)]
## Pull out P-Values from Regressions
AREA_saved_p_VisualQCFAIL<-lapply(AREA_summaries_VisualQCFAIL, function(x) x$coefficients[, c(4)])
AREA_p_Statistics_temp_VisualQCFAIL<-lapply(AREA_saved_p_VisualQCFAIL, function (x) x[c('CAT12Ratings')])
AREA_just_p_Statistics_VisualQCFAIL<-do.call(rbind.data.frame, AREA_p_Statistics_temp_VisualQCFAIL)
names(AREA_just_p_Statistics_VisualQCFAIL)[names(AREA_just_p_Statistics_VisualQCFAIL)=="c.1.05144678413837e.18..9.05675222619794e.10..2.40592537904889e.17.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
AREA_just_p_Statistics_VisualQCFAIL$BrainRegions<-(colnames(SubsNOTPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_p_Statistics_VisualQCFAIL<-AREA_just_p_Statistics_VisualQCFAIL[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse)
dk_statistical_values_AREA_T_VisualQCFAIL= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(AREA_just_T_Statistics_VisualQCFAIL$T_stat[1],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[2],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[3],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[4],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[5],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[6],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[7],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[8],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[9],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[10],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[11],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[12],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[13],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[14],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[15],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[16],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[17],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[18],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[19],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[20],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[21],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[22],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[23],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[24],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[25],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[26],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[27],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[28],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[29],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[30],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[31],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[32],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[33],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[34],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[35],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[36],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[37],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[38],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[39],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[40],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[41],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[42],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[43],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[44],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[45],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[46],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[47],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[48],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[49],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[50],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[51],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[52],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[53],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[54],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[55],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[56],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[57],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[58],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[59],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[60],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[61],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[62],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[63],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[64],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[65],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[66],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[67],
AREA_just_T_Statistics_VisualQCFAIL$T_stat[68]))
# Make tibble to eventually put into ggseg [for p-values]
dk_statistical_values_AREA_p_VisualQCFAIL= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(AREA_just_p_Statistics_VisualQCFAIL$pvalue[1],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[2],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[3],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[4],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[5],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[6],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[7],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[8],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[9],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[10],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[11],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[12],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[13],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[14],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[15],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[16],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[17],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[18],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[19],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[20],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[21],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[22],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[23],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[24],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[25],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[26],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[27],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[28],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[29],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[30],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[31],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[32],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[33],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[34],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[35],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[36],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[37],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[38],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[39],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[40],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[41],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[42],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[43],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[44],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[45],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[46],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[47],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[48],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[49],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[50],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[51],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[52],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[53],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[54],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[55],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[56],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[57],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[58],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[59],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[60],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[61],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[62],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[63],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[64],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[65],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[66],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[67],
AREA_just_p_Statistics_VisualQCFAIL$pvalue[68]))
library(stats)
# We correct for multiple comparisons with this call
dk_statistical_values_AREA_p_VisualQCFAIL$p_adjusted<-p.adjust(dk_statistical_values_AREA_p_VisualQCFAIL$p, method = "BH", n = length(dk_statistical_values_AREA_p_VisualQCFAIL$p))
# We combine some dataframes
dk_statistical_values_AREA_T_p_VisualQCFAIL <- dk_statistical_values_AREA_T_VisualQCFAIL %>% dplyr::left_join(dk_statistical_values_AREA_p_VisualQCFAIL)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
AREA_Multiple_Comparisons_VisualQCFAIL<-as_tibble(as.numeric(dk_statistical_values_AREA_T_p_VisualQCFAIL$p_adjusted<.05))
AREA_Multiple_Comparisons_VisualQCFAIL$value<-car::recode(AREA_Multiple_Comparisons_VisualQCFAIL$value, "0=NA")
names(AREA_Multiple_Comparisons_VisualQCFAIL)[names(AREA_Multiple_Comparisons_VisualQCFAIL)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_AREA_T_w_MultipleComparisons_VisualQCFAIL <- cbind(dk_statistical_values_AREA_T_VisualQCFAIL, AREA_Multiple_Comparisons_VisualQCFAIL)
# We make 2 figures (but store them)
AREA_p1_VisualQCFAIL<-ggseg(dk_statistical_values_AREA_T_w_MultipleComparisons_VisualQCFAIL,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-14.75, 14)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
AREA_p2_VisualQCFAIL<-ggseg(dk_statistical_values_AREA_T_w_MultipleComparisons_VisualQCFAIL,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
library(cowplot)
# Then output and combine in cowplot
plot_grid(AREA_p1_VisualQCFAIL, AREA_p2_VisualQCFAIL,labels = c('Area T-Statistics \n Excluded Subjects', 'Survives Multiple \n Comparison Correction'))
Again, we also output a Table showing the stats for
QC and AREA volumes
with adjusted and unadjusted p-values
For the folks who like tables, etc.
Table S7
library(gt)
dk_statistical_values_AREA_T_p_VisualQCFAIL %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Area Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Area Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 10.10347 | 0.00000 | 0.00000 |
| lh_caudalanteriorcingulate | 6.53239 | 0.00000 | 0.00000 |
| lh_caudalmiddlefrontal | 9.58917 | 0.00000 | 0.00000 |
| lh_cuneus | 10.86482 | 0.00000 | 0.00000 |
| lh_entorhinal | 6.63293 | 0.00000 | 0.00000 |
| lh_fusiform | 11.88445 | 0.00000 | 0.00000 |
| lh_inferiorparietal | 12.04330 | 0.00000 | 0.00000 |
| lh_inferiortemporal | 10.84028 | 0.00000 | 0.00000 |
| lh_isthmuscingulate | 7.29951 | 0.00000 | 0.00000 |
| lh_lateraloccipital | 11.27899 | 0.00000 | 0.00000 |
| lh_lateralorbitofrontal | 8.46871 | 0.00000 | 0.00000 |
| lh_lingual | 13.05945 | 0.00000 | 0.00000 |
| lh_medialorbitofrontal | 7.97775 | 0.00000 | 0.00000 |
| lh_middletemporal | 9.90135 | 0.00000 | 0.00000 |
| lh_parahippocampal | 7.24795 | 0.00000 | 0.00000 |
| lh_paracentral | 6.02993 | 0.00000 | 0.00000 |
| lh_parsopercularis | 7.54271 | 0.00000 | 0.00000 |
| lh_parsorbitalis | 7.51014 | 0.00000 | 0.00000 |
| lh_parstriangularis | 7.94146 | 0.00000 | 0.00000 |
| lh_pericalcarine | 9.77865 | 0.00000 | 0.00000 |
| lh_postcentral | 8.27756 | 0.00000 | 0.00000 |
| lh_posteriorcingulate | 7.82725 | 0.00000 | 0.00000 |
| lh_precentral | 8.05284 | 0.00000 | 0.00000 |
| lh_precuneus | 11.07292 | 0.00000 | 0.00000 |
| lh_rostralanteriorcingulate | 7.15470 | 0.00000 | 0.00000 |
| lh_rostralmiddlefrontal | 11.20937 | 0.00000 | 0.00000 |
| lh_superiorfrontal | 9.25896 | 0.00000 | 0.00000 |
| lh_superiorparietal | 10.48320 | 0.00000 | 0.00000 |
| lh_superiortemporal | 9.75418 | 0.00000 | 0.00000 |
| lh_supramarginal | 7.39463 | 0.00000 | 0.00000 |
| lh_frontalpole | 7.41123 | 0.00000 | 0.00000 |
| lh_temporalpole | 4.91828 | 0.00000 | 0.00000 |
| lh_transversetemporal | 7.29497 | 0.00000 | 0.00000 |
| lh_insula | 5.14840 | 0.00000 | 0.00000 |
| rh_bankssts | 8.78240 | 0.00000 | 0.00000 |
| rh_caudalanteriorcingulate | 6.17777 | 0.00000 | 0.00000 |
| rh_caudalmiddlefrontal | 7.95974 | 0.00000 | 0.00000 |
| rh_cuneus | 10.72858 | 0.00000 | 0.00000 |
| rh_entorhinal | 4.16054 | 0.00005 | 0.00005 |
| rh_fusiform | 12.03989 | 0.00000 | 0.00000 |
| rh_inferiorparietal | 9.88680 | 0.00000 | 0.00000 |
| rh_inferiortemporal | 11.57861 | 0.00000 | 0.00000 |
| rh_isthmuscingulate | 6.17735 | 0.00000 | 0.00000 |
| rh_lateraloccipital | 11.06783 | 0.00000 | 0.00000 |
| rh_lateralorbitofrontal | 7.06515 | 0.00000 | 0.00000 |
| rh_lingual | 11.66161 | 0.00000 | 0.00000 |
| rh_medialorbitofrontal | 7.82038 | 0.00000 | 0.00000 |
| rh_middletemporal | 10.08340 | 0.00000 | 0.00000 |
| rh_parahippocampal | 8.97964 | 0.00000 | 0.00000 |
| rh_paracentral | 6.33006 | 0.00000 | 0.00000 |
| rh_parsopercularis | 8.67628 | 0.00000 | 0.00000 |
| rh_parsorbitalis | 9.09594 | 0.00000 | 0.00000 |
| rh_parstriangularis | 8.32435 | 0.00000 | 0.00000 |
| rh_pericalcarine | 11.25366 | 0.00000 | 0.00000 |
| rh_postcentral | 7.40468 | 0.00000 | 0.00000 |
| rh_posteriorcingulate | 7.98093 | 0.00000 | 0.00000 |
| rh_precentral | 8.83777 | 0.00000 | 0.00000 |
| rh_precuneus | 9.14683 | 0.00000 | 0.00000 |
| rh_rostralanteriorcingulate | 7.34161 | 0.00000 | 0.00000 |
| rh_rostralmiddlefrontal | 10.58123 | 0.00000 | 0.00000 |
| rh_superiorfrontal | 8.16569 | 0.00000 | 0.00000 |
| rh_superiorparietal | 9.26790 | 0.00000 | 0.00000 |
| rh_superiortemporal | 8.91482 | 0.00000 | 0.00000 |
| rh_supramarginal | 6.52441 | 0.00000 | 0.00000 |
| rh_frontalpole | 5.02205 | 0.00000 | 0.00000 |
| rh_temporalpole | 3.96953 | 0.00011 | 0.00011 |
| rh_transversetemporal | 5.36228 | 0.00000 | 0.00000 |
| rh_insula | 6.19790 | 0.00000 | 0.00000 |
Descriptive Statistics about t-values for AREA
And MRI Quality for excluded subjects
range(dk_statistical_values_AREA_T_p_VisualQCFAIL$t)
## [1] 3.969527 13.059452
mean(dk_statistical_values_AREA_T_p_VisualQCFAIL$t)
## [1] 8.534611
sd(dk_statistical_values_AREA_T_p_VisualQCFAIL$t)
## [1] 2.094599
table(dk_statistical_values_AREA_T_p_VisualQCFAIL$p>.05)
##
## FALSE
## 68
table(is.na(AREA_Multiple_Comparisons_VisualQCFAIL))
##
## FALSE
## 68
Now doing this for cortical thickness
For the excluded subjects
SubsNOTPassingVisualQC_Freesurfer_THICKNESS<-SubsNOTPassingVisualQC[,149:217]
THICKNESS_for_Figure_VisualQCFAIL<-SubsNOTPassingVisualQC_Freesurfer_THICKNESS[,1:68]
CAT12Ratings<-SubsNOTPassingVisualQC_Freesurfer_THICKNESS[,69]
## Regression Loop, with Thickness as DV and Age & QC as IVs
n<-68
THICKNESS_Loop_to_Extract_Tstats_VisualQCFAIL <- lapply(1:n, function(x) lm(THICKNESS_for_Figure_VisualQCFAIL[,x] ~ CAT12Ratings))
## Pull out T-Statistics from Regressions
THICKNESS_summaries_VisualQCFAIL <- lapply(THICKNESS_Loop_to_Extract_Tstats_VisualQCFAIL, summary)
THICKNESS_saved_T_VisualQCFAIL<-lapply(THICKNESS_summaries_VisualQCFAIL, function(x) x$coefficients[, c(3)])
THICKNESS_T_Statistics_temp_VisualQCFAIL<-lapply(THICKNESS_saved_T_VisualQCFAIL, function (x) x[c('CAT12Ratings')])
THICKNESS_just_T_Statistics_VisualQCFAIL<-do.call(rbind.data.frame, THICKNESS_T_Statistics_temp_VisualQCFAIL)
names(THICKNESS_just_T_Statistics_VisualQCFAIL)[names(THICKNESS_just_T_Statistics_VisualQCFAIL)=="c.2.06163535629417..3.98040938991008..1.02691799995299...0.167248611872701.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
THICKNESS_just_T_Statistics_VisualQCFAIL$BrainRegions<-(colnames(SubsNOTPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_T_Statistics_VisualQCFAIL<-THICKNESS_just_T_Statistics_VisualQCFAIL[, c(2,1)]
## Pull out P-Values from Regressions
THICKNESS_saved_p_VisualQCFAIL<-lapply(THICKNESS_summaries_VisualQCFAIL, function(x) x$coefficients[, c(4)])
THICKNESS_p_Statistics_temp_VisualQCFAIL<-lapply(THICKNESS_saved_p_VisualQCFAIL, function (x) x[c('CAT12Ratings')])
THICKNESS_just_p_Statistics_VisualQCFAIL<-do.call(rbind.data.frame, THICKNESS_p_Statistics_temp_VisualQCFAIL)
names(THICKNESS_just_p_Statistics_VisualQCFAIL)[names(THICKNESS_just_p_Statistics_VisualQCFAIL)=="c.0.040934427774062..0.000105977575147356..0.306079862403912.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
THICKNESS_just_p_Statistics_VisualQCFAIL$BrainRegions<-(colnames(SubsNOTPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_p_Statistics_VisualQCFAIL<-THICKNESS_just_p_Statistics_VisualQCFAIL[, c(2,1)]
# Make tibble to eventually put into ggseg [for t-statistics]
dk_statistical_values_THICK_T_VisualQCFAIL= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[1],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[2],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[3],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[4],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[5],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[6],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[7],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[8],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[9],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[10],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[11],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[12],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[13],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[14],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[15],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[16],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[17],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[18],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[19],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[20],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[21],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[22],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[23],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[24],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[25],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[26],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[27],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[28],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[29],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[30],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[31],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[32],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[33],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[34],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[35],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[36],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[37],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[38],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[39],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[40],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[41],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[42],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[43],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[44],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[45],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[46],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[47],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[48],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[49],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[50],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[51],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[52],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[53],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[54],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[55],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[56],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[57],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[58],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[59],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[60],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[61],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[62],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[63],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[64],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[65],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[66],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[67],
THICKNESS_just_T_Statistics_VisualQCFAIL$T_stat[68]))
# Make tibble to eventually put into ggseg [for p-values]
dk_statistical_values_THICK_p_VisualQCFAIL= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[1],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[2],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[3],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[4],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[5],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[6],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[7],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[8],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[9],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[10],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[11],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[12],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[13],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[14],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[15],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[16],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[17],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[18],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[19],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[20],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[21],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[22],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[23],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[24],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[25],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[26],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[27],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[28],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[29],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[30],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[31],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[32],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[33],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[34],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[35],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[36],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[37],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[38],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[39],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[40],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[41],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[42],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[43],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[44],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[45],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[46],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[47],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[48],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[49],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[50],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[51],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[52],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[53],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[54],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[55],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[56],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[57],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[58],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[59],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[60],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[61],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[62],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[63],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[64],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[65],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[66],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[67],
THICKNESS_just_p_Statistics_VisualQCFAIL$pvalue[68]))
# We correct for multiple comparisons with this call
dk_statistical_values_THICK_p_VisualQCFAIL$p_adjusted<-p.adjust(dk_statistical_values_THICK_p_VisualQCFAIL$p, method = "BH", n = length(dk_statistical_values_THICK_p_VisualQCFAIL$p))
# We combine some dataframes
dk_statistical_values_THICK_T_p_VisualQCFAIL <- dk_statistical_values_THICK_T_VisualQCFAIL %>% dplyr::left_join(dk_statistical_values_THICK_p_VisualQCFAIL)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
THICK_Multiple_Comparisons_VisualQCFAIL<-as_tibble(as.numeric(dk_statistical_values_THICK_T_p_VisualQCFAIL$p_adjusted<.05))
THICK_Multiple_Comparisons_VisualQCFAIL$value<-car::recode(THICK_Multiple_Comparisons_VisualQCFAIL$value, "0=NA")
names(THICK_Multiple_Comparisons_VisualQCFAIL)[names(THICK_Multiple_Comparisons_VisualQCFAIL)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_THICK_T_w_MultipleComparisons_VisualQCFAIL <- cbind(dk_statistical_values_THICK_T_VisualQCFAIL, THICK_Multiple_Comparisons_VisualQCFAIL)
# We make 2 figures (but store them)
THICK_p1_VisualQCFAIL<-ggseg(dk_statistical_values_THICK_T_w_MultipleComparisons_VisualQCFAIL,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-14.75, 14)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
THICK_p2_VisualQCFAIL<-ggseg(dk_statistical_values_THICK_T_w_MultipleComparisons_VisualQCFAIL,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(THICK_p1_VisualQCFAIL, THICK_p2_VisualQCFAIL,labels = c('THICKNESS T-Statistics \n Excluded Subjects', 'Survives Multiple \n Comparison Correction'))
Again, we also output a Table showing the stats for
QC and aseg volumes
with adjusted and unadjusted p-values
For the folks who like tables, etc.
Table S8
dk_statistical_values_THICK_T_p_VisualQCFAIL %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('THICKNESS Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| THICKNESS Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 2.06164 | 0.04093 | 0.06051 |
| lh_caudalanteriorcingulate | 3.98041 | 0.00011 | 0.00048 |
| lh_caudalmiddlefrontal | 1.02692 | 0.30608 | 0.36515 |
| lh_cuneus | -0.16725 | 0.86740 | 0.89368 |
| lh_entorhinal | 2.88972 | 0.00442 | 0.01001 |
| lh_fusiform | 2.35481 | 0.01980 | 0.03284 |
| lh_inferiorparietal | 2.72286 | 0.00722 | 0.01535 |
| lh_inferiortemporal | 3.92038 | 0.00013 | 0.00053 |
| lh_isthmuscingulate | 1.56889 | 0.11874 | 0.14680 |
| lh_lateraloccipital | -1.00158 | 0.31813 | 0.37297 |
| lh_lateralorbitofrontal | 5.39595 | 0.00000 | 0.00000 |
| lh_lingual | 0.78743 | 0.43225 | 0.49818 |
| lh_medialorbitofrontal | 2.29583 | 0.02304 | 0.03659 |
| lh_middletemporal | 3.78915 | 0.00022 | 0.00082 |
| lh_parahippocampal | 1.51277 | 0.13240 | 0.16077 |
| lh_paracentral | 0.68373 | 0.49518 | 0.56120 |
| lh_parsopercularis | 5.86403 | 0.00000 | 0.00000 |
| lh_parsorbitalis | 3.60574 | 0.00042 | 0.00130 |
| lh_parstriangularis | 2.29426 | 0.02314 | 0.03659 |
| lh_pericalcarine | -1.81708 | 0.07116 | 0.09306 |
| lh_postcentral | 0.04251 | 0.96615 | 0.96615 |
| lh_posteriorcingulate | 3.19421 | 0.00170 | 0.00429 |
| lh_precentral | 1.64579 | 0.10186 | 0.13069 |
| lh_precuneus | 3.01261 | 0.00303 | 0.00711 |
| lh_rostralanteriorcingulate | 4.78827 | 0.00000 | 0.00003 |
| lh_rostralmiddlefrontal | 0.53947 | 0.59035 | 0.63720 |
| lh_superiorfrontal | 2.35541 | 0.01977 | 0.03284 |
| lh_superiorparietal | 2.48932 | 0.01387 | 0.02506 |
| lh_superiortemporal | 6.41268 | 0.00000 | 0.00000 |
| lh_supramarginal | 3.69977 | 0.00030 | 0.00108 |
| lh_frontalpole | 2.55675 | 0.01154 | 0.02180 |
| lh_temporalpole | 4.03005 | 0.00009 | 0.00044 |
| lh_transversetemporal | 3.95677 | 0.00012 | 0.00049 |
| lh_insula | 12.71774 | 0.00000 | 0.00000 |
| rh_bankssts | 5.45536 | 0.00000 | 0.00000 |
| rh_caudalanteriorcingulate | 4.11685 | 0.00006 | 0.00039 |
| rh_caudalmiddlefrontal | 2.48572 | 0.01400 | 0.02506 |
| rh_cuneus | 1.59976 | 0.11171 | 0.14068 |
| rh_entorhinal | 0.12978 | 0.89691 | 0.91029 |
| rh_fusiform | 3.65978 | 0.00035 | 0.00112 |
| rh_inferiorparietal | 4.29237 | 0.00003 | 0.00021 |
| rh_inferiortemporal | 2.70192 | 0.00767 | 0.01581 |
| rh_isthmuscingulate | 3.01874 | 0.00297 | 0.00711 |
| rh_lateraloccipital | 3.68066 | 0.00032 | 0.00109 |
| rh_lateralorbitofrontal | 0.29459 | 0.76870 | 0.81675 |
| rh_lingual | 5.20897 | 0.00000 | 0.00001 |
| rh_medialorbitofrontal | 0.18259 | 0.85537 | 0.89368 |
| rh_middletemporal | 3.42907 | 0.00078 | 0.00212 |
| rh_parahippocampal | 4.01859 | 0.00009 | 0.00044 |
| rh_paracentral | 3.45966 | 0.00070 | 0.00199 |
| rh_parsopercularis | 1.92726 | 0.05580 | 0.07744 |
| rh_parsorbitalis | 3.49674 | 0.00062 | 0.00182 |
| rh_parstriangularis | 1.85466 | 0.06557 | 0.08743 |
| rh_pericalcarine | 2.06384 | 0.04072 | 0.06051 |
| rh_postcentral | -2.03416 | 0.04366 | 0.06317 |
| rh_posteriorcingulate | 0.66700 | 0.50578 | 0.56382 |
| rh_precentral | 1.88143 | 0.06181 | 0.08407 |
| rh_precuneus | 2.22753 | 0.02737 | 0.04230 |
| rh_rostralanteriorcingulate | 3.24617 | 0.00144 | 0.00376 |
| rh_rostralmiddlefrontal | 4.90336 | 0.00000 | 0.00002 |
| rh_superiorfrontal | 0.58971 | 0.55625 | 0.61009 |
| rh_superiorparietal | 1.96666 | 0.05103 | 0.07229 |
| rh_superiortemporal | 2.62962 | 0.00942 | 0.01830 |
| rh_supramarginal | 4.58532 | 0.00001 | 0.00007 |
| rh_frontalpole | 4.05206 | 0.00008 | 0.00044 |
| rh_temporalpole | 2.47184 | 0.01454 | 0.02535 |
| rh_transversetemporal | 2.67065 | 0.00839 | 0.01678 |
| rh_insula | 2.75942 | 0.00650 | 0.01425 |
Descriptive Statistics about t-values for THICKNESS
And MRI Quality for excluded subjects
range(dk_statistical_values_THICK_T_p_VisualQCFAIL$t)
## [1] -2.03416 12.71774
mean(dk_statistical_values_THICK_T_p_VisualQCFAIL$t)
## [1] 2.719169
sd(dk_statistical_values_THICK_T_p_VisualQCFAIL$t)
## [1] 2.128905
table(dk_statistical_values_THICK_T_p_VisualQCFAIL$p>.05)
##
## FALSE TRUE
## 47 21
table(is.na(THICK_Multiple_Comparisons_VisualQCFAIL))
##
## FALSE TRUE
## 44 24
One more set of loops and data organization
This final time for the subcortical volumes
For excluded subjects
SubsNOTPassingVisualQC<-subset(combined,combined$passing==0)
SubsNOTPassingVisualQC_Freesurfer_ASEG<-SubsNOTPassingVisualQC[,14:58]
SubsNOTPassingVisualQC_Freesurfer_ASEG<-SubsNOTPassingVisualQC_Freesurfer_ASEG %>% dplyr::select(-c(Left.Cerebellum.White.Matter, Left.Cerebellum.Cortex, Left.Lateral.Ventricle,Left.Inf.Lat.Vent,X3rd.Ventricle,X4th.Ventricle,CSF,Left.vessel,Left.choroid.plexus,Right.Cerebellum.White.Matter,Right.Cerebellum.Cortex,Right.Lateral.Ventricle,Right.Inf.Lat.Vent,Right.vessel,Right.choroid.plexus,X5th.Ventricle,WM.hypointensities,Left.WM.hypointensities,Right.WM.hypointensities,non.WM.hypointensities,Left.non.WM.hypointensities,Right.non.WM.hypointensities,Optic.Chiasm))
CAT12Ratings<-SubsNOTPassingVisualQC$CAT12_QC_Weighted_Average
## Regression Loop, with Aseg as DV and Age & QC as IVs
n<-22
ASEG_Loop_to_Extract_Tstats_VisualQCFAIL <- lapply(1:n, function(x) lm(SubsNOTPassingVisualQC_Freesurfer_ASEG[,x] ~ CAT12Ratings))
## Pull out T-Statistics from Regressions
ASEG_summaries_VisualQCFAIL <- lapply(ASEG_Loop_to_Extract_Tstats_VisualQCFAIL, summary)
ASEG_saved_T_VisualQCFAIL<-lapply(ASEG_summaries_VisualQCFAIL, function(x) x$coefficients[, c(3)])
ASEG_T_Statistics_temp_VisualQCFAIL<-lapply(ASEG_saved_T_VisualQCFAIL, function (x) x[c('CAT12Ratings')])
ASEG_just_T_Statistics_VisualQCFAIL<-do.call(rbind.data.frame, ASEG_T_Statistics_temp_VisualQCFAIL)
names(ASEG_just_T_Statistics_VisualQCFAIL)[names(ASEG_just_T_Statistics_VisualQCFAIL)=="c.3.22866772736006..7.4911604932771..5.49137069887108..5.85375969978923.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
ASEG_just_T_Statistics_VisualQCFAIL$BrainRegions<-(colnames(SubsNOTPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_T_Statistics_VisualQCFAIL<-ASEG_just_T_Statistics_VisualQCFAIL[, c(2,1)]
## Pull out P-Values from Regressions
ASEG_saved_p_VisualQCFAIL<-lapply(ASEG_summaries_VisualQCFAIL, function(x) x$coefficients[, c(4)])
ASEG_p_Statistics_temp_VisualQCFAIL<-lapply(ASEG_saved_p_VisualQCFAIL, function (x) x[c('CAT12Ratings')])
ASEG_just_p_Statistics_VisualQCFAIL<-do.call(rbind.data.frame, ASEG_p_Statistics_temp_VisualQCFAIL)
names(ASEG_just_p_Statistics_VisualQCFAIL)[names(ASEG_just_p_Statistics_VisualQCFAIL)=="c.0.00152198723339205..5.08428941156909e.12..1.6241460807106e.07.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
ASEG_just_p_Statistics_VisualQCFAIL$BrainRegions<-(colnames(SubsNOTPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_p_Statistics_VisualQCFAIL<-ASEG_just_p_Statistics_VisualQCFAIL[, c(2,1)]
# Make tibble to eventually put into ggseg [for t-statistics]
aseg_statistical_values_T_VisualQCFAIL= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
t=c(ASEG_just_T_Statistics_VisualQCFAIL$T_stat[1],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[2],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[3],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[4],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[5],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[6],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[7],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[8],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[9],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[10],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[11],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[12],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[13],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[14],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[15],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[16],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[17],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[18],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[19],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[20],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[21],
ASEG_just_T_Statistics_VisualQCFAIL$T_stat[22]))
# Make tibble to eventually put into ggseg [for p-values]
aseg_statistical_values_p_VisualQCFAIL= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
p=c(ASEG_just_p_Statistics_VisualQCFAIL$pvalue[1],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[2],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[3],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[4],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[5],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[6],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[7],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[8],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[9],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[10],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[11],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[12],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[13],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[14],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[15],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[16],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[17],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[18],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[19],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[20],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[21],
ASEG_just_p_Statistics_VisualQCFAIL$pvalue[22]))
# Multiple Comparison Correction
aseg_statistical_values_p_VisualQCFAIL$p_adjusted<-p.adjust(aseg_statistical_values_p_VisualQCFAIL$p, method = "BH", n = length(aseg_statistical_values_p_VisualQCFAIL$p))
aseg_statistical_values_T_p_VisualQCFAIL <- aseg_statistical_values_T_VisualQCFAIL %>% left_join(aseg_statistical_values_p_VisualQCFAIL)
## Joining, by = "label"
Aseg_Multiple_Comparisons_VisualQCFAIL<-as_tibble(as.numeric(aseg_statistical_values_T_p_VisualQCFAIL$p_adjusted<.05))
Aseg_Multiple_Comparisons_VisualQCFAIL$value<-car::recode(Aseg_Multiple_Comparisons_VisualQCFAIL$value, "0=NA")
names(Aseg_Multiple_Comparisons_VisualQCFAIL)[names(Aseg_Multiple_Comparisons_VisualQCFAIL)=="value"] <- "Survives_Multiple_Comparison_Correction"
aseg_statistical_values_T_w_MultipleComparisons_VisualQCFAIL <- cbind(aseg_statistical_values_T_VisualQCFAIL, Aseg_Multiple_Comparisons_VisualQCFAIL)
aseg_p1_VisualQCFAIL<-ggseg(aseg_statistical_values_T_VisualQCFAIL,atlas=aseg,position = "stacked",mapping=aes(fill=t,color=Survives_Multiple_Comparison_Correction),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-7.5, 7.5))+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbens-area 5.00
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumbens-area 7.19
aseg_p2_VisualQCFAIL<-ggseg(aseg_statistical_values_T_w_MultipleComparisons_VisualQCFAIL,atlas=aseg,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t Survives_Multiple_Comparis…
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbe… 5.00 1
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumb… 7.19 1
plot_grid(aseg_p1_VisualQCFAIL, aseg_p2_VisualQCFAIL,labels = c('Subcortical Volumes \n T-Statistics Exclude Subjects', 'Survives Multiple \n Comparison Correction'))
Again, we also output a Table showing the stats for
QC and aseg volumes
with adjusted and unadjusted p-values
For the folks who like tables, etc.
Table S9
aseg_statistical_values_T_p_VisualQCFAIL %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Aseg_Volume' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Aseg_Volume | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| Left-Thalamus-Proper | 3.22867 | 0.00152 | 0.00335 |
| Left-Caudate | 7.49116 | 0.00000 | 0.00000 |
| Left-Putamen | 5.49137 | 0.00000 | 0.00000 |
| Left-Pallidum | 5.85376 | 0.00000 | 0.00000 |
| brain-stem | 1.93532 | 0.05480 | 0.08611 |
| Left-Hippocampus | 1.51839 | 0.13098 | 0.19210 |
| Left-Amygdala | 2.81190 | 0.00557 | 0.01114 |
| Left-Accumbens-area | 5.00261 | 0.00000 | 0.00000 |
| Left-VentralDC | 0.57192 | 0.56822 | 0.62504 |
| Right-Thalamus-Proper | 3.49651 | 0.00062 | 0.00151 |
| Right-Caudate | 6.46874 | 0.00000 | 0.00000 |
| Right-Putamen | 5.57298 | 0.00000 | 0.00000 |
| Right-Pallidum | 3.66350 | 0.00034 | 0.00094 |
| Right-Hippocampus | 1.12371 | 0.26290 | 0.32132 |
| Right-Amygdala | 2.54754 | 0.01184 | 0.02170 |
| Right-Accumbens-area | 7.18755 | 0.00000 | 0.00000 |
| Right-VentralDC | 0.62059 | 0.53579 | 0.62039 |
| cc-posterior | -0.46795 | 0.64049 | 0.67099 |
| cc-mid-posterior | -1.44270 | 0.15115 | 0.20783 |
| cc-central | -1.16938 | 0.24407 | 0.31585 |
| cc-mid-anterior | -2.12969 | 0.03480 | 0.05889 |
| cc-anterior | 0.20366 | 0.83889 | 0.83889 |
Descriptive Statistics about t-values for ASEG
And MRI Quality for excluded subjects
range(aseg_statistical_values_T_p_VisualQCFAIL$t)
## [1] -2.129688 7.491160
mean(aseg_statistical_values_T_p_VisualQCFAIL$t)
## [1] 2.708188
sd(aseg_statistical_values_T_p_VisualQCFAIL$t)
## [1] 2.890981
table(aseg_statistical_values_T_p_VisualQCFAIL$p>.05)
##
## FALSE TRUE
## 13 9
table(is.na(Aseg_Multiple_Comparisons_VisualQCFAIL))
##
## FALSE TRUE
## 12 10
S7. Association Between Freesurfer Outputs and Freesurfer’s Euler Number, Controlling CAT12 Scan Rating
combined<-read.csv("HBN_combined_2021_03_04_full.csv")
combined<-subset(combined,combined$CAT12_QC_Weighted_Average!="NA")
OnlySubsPassingVisualQC<-subset(combined,combined$passing==1)
OnlySubsPassingVisualQC_Freesurfer_AREA<-OnlySubsPassingVisualQC[,78:147]
OnlySubsPassingVisualQC_Freesurfer_AREA<-OnlySubsPassingVisualQC_Freesurfer_AREA %>% dplyr::select(-c(lh_WhiteSurfArea_area,eTIV))
OnlySubsPassingVisualQC_Freesurfer_AREA$CAT12_QC_Weighted_Average<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
n<-68
AREA_for_Figure<-OnlySubsPassingVisualQC_Freesurfer_AREA[,1:68]
CAT12Ratings<-OnlySubsPassingVisualQC_Freesurfer_AREA[,69]
Euler<-OnlySubsPassingVisualQC$SurfaceHoles
#Regression Loops
AREA_Loop_to_Extract_Tstats_Focused_on_Euler <- lapply(1:n, function(x) lm(AREA_for_Figure[,x] ~ Euler + CAT12Ratings))
#Pulling out t-statistics, etc.
AREA_summaries_Focused_on_Euler <- lapply(AREA_Loop_to_Extract_Tstats_Focused_on_Euler, summary)
AREA_saved_T_Focused_on_Euler<-lapply(AREA_summaries_Focused_on_Euler, function(x) x$coefficients[, c(3)])
AREA_T_Statistics_temp_Focused_on_Euler<-lapply(AREA_saved_T_Focused_on_Euler, function (x) x[c('Euler')])
AREA_just_T_Statistics_Focused_on_Euler<-do.call(rbind.data.frame, AREA_T_Statistics_temp_Focused_on_Euler)
names(AREA_just_T_Statistics_Focused_on_Euler)[names(AREA_just_T_Statistics_Focused_on_Euler)=="c.1.83586778105686...0.261617821918625...0.208410179122046...0.578921737555894.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
AREA_just_T_Statistics_Focused_on_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_T_Statistics_Focused_on_Euler<-AREA_just_T_Statistics_Focused_on_Euler[, c(2,1)]
## Pull out P-Values from Regressions
AREA_saved_p_Focused_on_Euler<-lapply(AREA_summaries_Focused_on_Euler, function(x) x$coefficients[, c(4)])
AREA_p_Statistics_temp_Focused_on_Euler<-lapply(AREA_saved_p_Focused_on_Euler, function (x) x[c('Euler')])
AREA_just_p_Statistics_Focused_on_Euler<-do.call(rbind.data.frame, AREA_p_Statistics_temp_Focused_on_Euler)
names(AREA_just_p_Statistics_Focused_on_Euler)[names(AREA_just_p_Statistics_Focused_on_Euler)=="c.0.0678257100212255..0.793878767715084..0.835115629672493..0.563277524044754.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
AREA_just_p_Statistics_Focused_on_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_AREA)[1:68])
AREA_just_p_Statistics_Focused_on_Euler<-AREA_just_p_Statistics_Focused_on_Euler[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse);library(stats);library(gt);library(cowplot);library(dplyr)
dk_statistical_values_AREA_T_Focused_on_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(AREA_just_T_Statistics_Focused_on_Euler$T_stat[1],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[2],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[3],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[4],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[5],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[6],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[7],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[8],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[9],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[10],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[11],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[12],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[13],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[14],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[15],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[16],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[17],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[18],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[19],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[20],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[21],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[22],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[23],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[24],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[25],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[26],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[27],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[28],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[29],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[30],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[31],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[32],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[33],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[34],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[35],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[36],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[37],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[38],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[39],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[40],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[41],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[42],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[43],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[44],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[45],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[46],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[47],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[48],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[49],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[50],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[51],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[52],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[53],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[54],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[55],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[56],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[57],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[58],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[59],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[60],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[61],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[62],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[63],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[64],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[65],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[66],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[67],
AREA_just_T_Statistics_Focused_on_Euler$T_stat[68]))
dk_statistical_values_AREA_p_Focused_on_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(AREA_just_p_Statistics_Focused_on_Euler$pvalue[1],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[2],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[3],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[4],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[5],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[6],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[7],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[8],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[9],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[10],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[11],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[12],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[13],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[14],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[15],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[16],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[17],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[18],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[19],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[20],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[21],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[22],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[23],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[24],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[25],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[26],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[27],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[28],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[29],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[30],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[31],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[32],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[33],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[34],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[35],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[36],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[37],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[38],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[39],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[40],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[41],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[42],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[43],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[44],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[45],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[46],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[47],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[48],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[49],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[50],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[51],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[52],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[53],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[54],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[55],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[56],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[57],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[58],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[59],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[60],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[61],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[62],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[63],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[64],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[65],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[66],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[67],
AREA_just_p_Statistics_Focused_on_Euler$pvalue[68]))
library(stats)
# We correct for multiple comparisons with this call
dk_statistical_values_AREA_p_Focused_on_Euler$p_adjusted<-p.adjust(dk_statistical_values_AREA_p_Focused_on_Euler$p, method = "BH", n = length(dk_statistical_values_AREA_p_Focused_on_Euler$p))
# We combine some dataframes
dk_statistical_values_AREA_T_p_Focused_on_Euler <- dk_statistical_values_AREA_T_Focused_on_Euler %>% dplyr::left_join(dk_statistical_values_AREA_p_Focused_on_Euler)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
AREA_Multiple_Comparisons_Focused_on_Euler<-as_tibble(as.numeric(dk_statistical_values_AREA_T_p_Focused_on_Euler$p_adjusted<.05))
AREA_Multiple_Comparisons_Focused_on_Euler$value<-car::recode(AREA_Multiple_Comparisons_Focused_on_Euler$value, "0=NA")
names(AREA_Multiple_Comparisons_Focused_on_Euler)[names(AREA_Multiple_Comparisons_Focused_on_Euler)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_AREA_T_Focused_on_Euler_w_MultipleComparisons <- cbind(dk_statistical_values_AREA_T_Focused_on_Euler, AREA_Multiple_Comparisons_Focused_on_Euler)
# We make 2 figures (but store them)
AREA_p1_Focused_on_Euler<-ggseg(dk_statistical_values_AREA_T_Focused_on_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
AREA_p2_Focused_on_Euler<-ggseg(dk_statistical_values_AREA_T_Focused_on_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=Survives_Multiple_Comparison_Correction),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(AREA_p1_Focused_on_Euler, AREA_p2_Focused_on_Euler,labels = c('Area T-Statistics \nFocusing on Euler Number', 'Survives Multiple \n Comparison Correction'))
Table S4
dk_statistical_values_AREA_T_p_Focused_on_Euler %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Area Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Area Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 1.83587 | 0.06783 | 0.51246 |
| lh_caudalanteriorcingulate | -0.26162 | 0.79388 | 0.97193 |
| lh_caudalmiddlefrontal | -0.20841 | 0.83512 | 0.97193 |
| lh_cuneus | -0.57892 | 0.56328 | 0.97193 |
| lh_entorhinal | -0.12222 | 0.90285 | 0.97193 |
| lh_fusiform | -0.54658 | 0.58526 | 0.97193 |
| lh_inferiorparietal | 0.43118 | 0.66679 | 0.97193 |
| lh_inferiortemporal | -0.48349 | 0.62927 | 0.97193 |
| lh_isthmuscingulate | -0.10679 | 0.91506 | 0.97193 |
| lh_lateraloccipital | -0.03731 | 0.97028 | 0.99792 |
| lh_lateralorbitofrontal | -0.93285 | 0.35199 | 0.93428 |
| lh_lingual | -1.83971 | 0.06726 | 0.51246 |
| lh_medialorbitofrontal | -0.75944 | 0.44846 | 0.93428 |
| lh_middletemporal | -0.17464 | 0.86153 | 0.97193 |
| lh_parahippocampal | -0.73790 | 0.46142 | 0.93428 |
| lh_paracentral | 0.41651 | 0.67748 | 0.97193 |
| lh_parsopercularis | 0.35426 | 0.72351 | 0.97193 |
| lh_parsorbitalis | -0.16159 | 0.87178 | 0.97193 |
| lh_parstriangularis | 0.00941 | 0.99250 | 0.99792 |
| lh_pericalcarine | -1.67999 | 0.09448 | 0.61597 |
| lh_postcentral | 1.92355 | 0.05580 | 0.51246 |
| lh_posteriorcingulate | 0.20884 | 0.83478 | 0.97193 |
| lh_precentral | 0.84380 | 0.39977 | 0.93428 |
| lh_precuneus | -0.25541 | 0.79866 | 0.97193 |
| lh_rostralanteriorcingulate | -0.76035 | 0.44792 | 0.93428 |
| lh_rostralmiddlefrontal | -0.74785 | 0.45541 | 0.93428 |
| lh_superiorfrontal | -0.12026 | 0.90439 | 0.97193 |
| lh_superiorparietal | 1.24021 | 0.21632 | 0.83028 |
| lh_superiortemporal | 1.91627 | 0.05672 | 0.51246 |
| lh_supramarginal | 1.07270 | 0.28467 | 0.93428 |
| lh_frontalpole | 0.51891 | 0.60438 | 0.97193 |
| lh_temporalpole | 0.55723 | 0.57798 | 0.97193 |
| lh_transversetemporal | 2.39629 | 0.01746 | 0.36219 |
| lh_insula | 0.09048 | 0.92799 | 0.97193 |
| rh_bankssts | 2.24409 | 0.02590 | 0.36219 |
| rh_caudalanteriorcingulate | -0.70618 | 0.48088 | 0.93428 |
| rh_caudalmiddlefrontal | 0.25943 | 0.79557 | 0.97193 |
| rh_cuneus | 0.89956 | 0.36941 | 0.93428 |
| rh_entorhinal | 1.08509 | 0.27916 | 0.93428 |
| rh_fusiform | -0.36515 | 0.71538 | 0.97193 |
| rh_inferiorparietal | 0.33018 | 0.74160 | 0.97193 |
| rh_inferiortemporal | 0.72076 | 0.47188 | 0.93428 |
| rh_isthmuscingulate | -0.50220 | 0.61606 | 0.97193 |
| rh_lateraloccipital | -0.08915 | 0.92905 | 0.97193 |
| rh_lateralorbitofrontal | -0.77132 | 0.44141 | 0.93428 |
| rh_lingual | -1.23088 | 0.21978 | 0.83028 |
| rh_medialorbitofrontal | -0.75513 | 0.45104 | 0.93428 |
| rh_middletemporal | 1.50389 | 0.13415 | 0.65158 |
| rh_parahippocampal | -1.57086 | 0.11776 | 0.61597 |
| rh_paracentral | 0.90084 | 0.36873 | 0.93428 |
| rh_parsopercularis | -0.57944 | 0.56293 | 0.97193 |
| rh_parsorbitalis | -0.16752 | 0.86712 | 0.97193 |
| rh_parstriangularis | 0.00261 | 0.99792 | 0.99792 |
| rh_pericalcarine | -0.86118 | 0.39015 | 0.93428 |
| rh_postcentral | 1.33670 | 0.18280 | 0.77690 |
| rh_posteriorcingulate | 1.04551 | 0.29702 | 0.93428 |
| rh_precentral | 1.38115 | 0.16874 | 0.76493 |
| rh_precuneus | -0.44621 | 0.65592 | 0.97193 |
| rh_rostralanteriorcingulate | -2.49618 | 0.01334 | 0.36219 |
| rh_rostralmiddlefrontal | -0.47846 | 0.63283 | 0.97193 |
| rh_superiorfrontal | 0.10359 | 0.91759 | 0.97193 |
| rh_superiorparietal | 0.87418 | 0.38304 | 0.93428 |
| rh_superiortemporal | 2.23297 | 0.02663 | 0.36219 |
| rh_supramarginal | 1.63666 | 0.10324 | 0.61597 |
| rh_frontalpole | 1.58866 | 0.11368 | 0.61597 |
| rh_temporalpole | 0.41026 | 0.68204 | 0.97193 |
| rh_transversetemporal | 2.69087 | 0.00771 | 0.36219 |
| rh_insula | 0.36302 | 0.71697 | 0.97193 |
Descriptive Statistics about t-values for Area
And MRI Quality (controlling for Euler number)
range(dk_statistical_values_AREA_T_p_Focused_on_Euler$t)
## [1] -2.496185 2.690873
mean(dk_statistical_values_AREA_T_p_Focused_on_Euler$t)
## [1] 0.2042698
sd(dk_statistical_values_AREA_T_p_Focused_on_Euler$t)
## [1] 1.06877
table(dk_statistical_values_AREA_T_p_Focused_on_Euler$p>.05)
##
## FALSE TRUE
## 5 63
table(is.na(AREA_Multiple_Comparisons_Focused_on_Euler))
##
## TRUE
## 68
We now do the same thing for cortical thickness
[ Same tibbling and regression loops, etc.]
Figure S9
OnlySubsPassingVisualQC_Freesurfer_THICKNESS<-OnlySubsPassingVisualQC[,149:217]
OnlySubsPassingVisualQC_Freesurfer_THICKNESS<-OnlySubsPassingVisualQC_Freesurfer_THICKNESS %>% dplyr::select(-c(lh_MeanThickness_thickness))
OnlySubsPassingVisualQC_Freesurfer_THICKNESS$CAT12_QC_Weighted_Average<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
## Add Age and QC "back in"
THICKNESS_for_Figure<-OnlySubsPassingVisualQC_Freesurfer_THICKNESS[,1:68]
CAT12Ratings<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Euler<-OnlySubsPassingVisualQC$SurfaceHoles
## Regression Loop, with Thickness as DV and Age & QC as IVs
n<-68
THICKNESS_Loop_to_Extract_Tstats_Focused_on_Euler <- lapply(1:n, function(x) lm(THICKNESS_for_Figure[,x] ~ Euler + CAT12Ratings))
#Pulling out t-statistics, etc.
THICKNESS_summaries_Focused_on_Euler <- lapply(THICKNESS_Loop_to_Extract_Tstats_Focused_on_Euler, summary)
THICKNESS_saved_T_Focused_on_Euler<-lapply(THICKNESS_summaries_Focused_on_Euler, function(x) x$coefficients[, c(3)])
THICKNESS_T_Statistics_temp_Focused_on_Euler<-lapply(THICKNESS_saved_T_Focused_on_Euler, function (x) x[c('Euler')])
THICKNESS_just_T_Statistics_Focused_on_Euler<-do.call(rbind.data.frame, THICKNESS_T_Statistics_temp_Focused_on_Euler)
names(THICKNESS_just_T_Statistics_Focused_on_Euler)[names(THICKNESS_just_T_Statistics_Focused_on_Euler)=="c.2.37654287627714...0.844736803122303..3.02991808814569..1.57838118651282.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
THICKNESS_just_T_Statistics_Focused_on_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_T_Statistics_Focused_on_Euler<-THICKNESS_just_T_Statistics_Focused_on_Euler[, c(2,1)]
## Pull out P-Values from Regressions
THICKNESS_saved_p_Focused_on_Euler<-lapply(THICKNESS_summaries_Focused_on_Euler, function(x) x$coefficients[, c(4)])
THICKNESS_p_Statistics_temp_Focused_on_Euler<-lapply(THICKNESS_saved_p_Focused_on_Euler, function (x) x[c('Euler')])
THICKNESS_just_p_Statistics_Focused_on_Euler<-do.call(rbind.data.frame, THICKNESS_p_Statistics_temp_Focused_on_Euler)
names(THICKNESS_just_p_Statistics_Focused_on_Euler)[names(THICKNESS_just_p_Statistics_Focused_on_Euler)=="c.0.0183963035931976..0.399242572898481..0.00276108477252514.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
THICKNESS_just_p_Statistics_Focused_on_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_THICKNESS)[1:68])
THICKNESS_just_p_Statistics_Focused_on_Euler<-THICKNESS_just_p_Statistics_Focused_on_Euler[, c(2,1)]
library(ggseg); library(ggseg3d); library(tidyverse);library(stats);library(gt);library(cowplot);library(dplyr)
dk_statistical_values_THICKNESS_T_Focused_on_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
t=c(THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[1],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[2],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[3],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[4],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[5],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[6],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[7],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[8],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[9],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[10],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[11],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[12],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[13],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[14],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[15],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[16],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[17],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[18],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[19],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[20],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[21],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[22],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[23],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[24],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[25],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[26],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[27],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[28],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[29],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[30],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[31],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[32],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[33],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[34],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[35],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[36],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[37],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[38],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[39],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[40],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[41],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[42],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[43],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[44],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[45],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[46],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[47],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[48],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[49],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[50],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[51],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[52],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[53],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[54],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[55],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[56],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[57],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[58],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[59],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[60],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[61],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[62],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[63],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[64],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[65],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[66],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[67],
THICKNESS_just_T_Statistics_Focused_on_Euler$T_stat[68]))
dk_statistical_values_THICKNESS_p_Focused_on_Euler= tibble(
label=c("lh_bankssts",
"lh_caudalanteriorcingulate",
"lh_caudalmiddlefrontal",
"lh_cuneus",
"lh_entorhinal",
"lh_fusiform",
"lh_inferiorparietal",
"lh_inferiortemporal",
"lh_isthmuscingulate",
"lh_lateraloccipital",
"lh_lateralorbitofrontal",
"lh_lingual",
"lh_medialorbitofrontal",
"lh_middletemporal",
"lh_parahippocampal",
"lh_paracentral",
"lh_parsopercularis",
"lh_parsorbitalis",
"lh_parstriangularis",
"lh_pericalcarine",
"lh_postcentral",
"lh_posteriorcingulate",
"lh_precentral",
"lh_precuneus",
"lh_rostralanteriorcingulate",
"lh_rostralmiddlefrontal",
"lh_superiorfrontal",
"lh_superiorparietal",
"lh_superiortemporal",
"lh_supramarginal",
"lh_frontalpole",
"lh_temporalpole",
"lh_transversetemporal",
"lh_insula",
"rh_bankssts",
"rh_caudalanteriorcingulate",
"rh_caudalmiddlefrontal",
"rh_cuneus",
"rh_entorhinal",
"rh_fusiform",
"rh_inferiorparietal",
"rh_inferiortemporal",
"rh_isthmuscingulate",
"rh_lateraloccipital",
"rh_lateralorbitofrontal",
"rh_lingual",
"rh_medialorbitofrontal",
"rh_middletemporal",
"rh_parahippocampal",
"rh_paracentral",
"rh_parsopercularis",
"rh_parsorbitalis",
"rh_parstriangularis",
"rh_pericalcarine",
"rh_postcentral",
"rh_posteriorcingulate",
"rh_precentral",
"rh_precuneus",
"rh_rostralanteriorcingulate",
"rh_rostralmiddlefrontal",
"rh_superiorfrontal",
"rh_superiorparietal",
"rh_superiortemporal",
"rh_supramarginal",
"rh_frontalpole",
"rh_temporalpole",
"rh_transversetemporal",
"rh_insula"),
p=c(THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[1],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[2],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[3],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[4],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[5],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[6],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[7],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[8],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[9],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[10],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[11],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[12],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[13],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[14],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[15],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[16],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[17],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[18],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[19],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[20],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[21],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[22],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[23],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[24],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[25],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[26],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[27],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[28],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[29],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[30],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[31],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[32],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[33],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[34],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[35],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[36],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[37],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[38],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[39],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[40],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[41],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[42],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[43],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[44],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[45],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[46],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[47],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[48],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[49],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[50],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[51],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[52],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[53],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[54],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[55],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[56],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[57],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[58],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[59],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[60],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[61],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[62],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[63],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[64],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[65],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[66],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[67],
THICKNESS_just_p_Statistics_Focused_on_Euler$pvalue[68]))
Making Figure S9
And deal with multiple comparisons
# We correct for multiple comparisons with this call
dk_statistical_values_THICKNESS_p_Focused_on_Euler$p_adjusted<-p.adjust(dk_statistical_values_THICKNESS_p_Focused_on_Euler$p, method = "BH", n = length(dk_statistical_values_THICKNESS_p_Focused_on_Euler$p))
# We combine some dataframes
dk_statistical_values_THICKNESS_T_p_Focused_on_Euler <- dk_statistical_values_THICKNESS_T_Focused_on_Euler %>% left_join(dk_statistical_values_THICKNESS_p_Focused_on_Euler)
## Joining, by = "label"
# We select only regions that survive multiple comparisons, making others NA; we rename some columns
THICKNESS_Multiple_Comparisons_Focused_on_Euler<-as_tibble(as.numeric(dk_statistical_values_THICKNESS_T_p_Focused_on_Euler$p_adjusted<.05))
THICKNESS_Multiple_Comparisons_Focused_on_Euler$value<-car::recode(THICKNESS_Multiple_Comparisons_Focused_on_Euler$value, "0=NA")
names(THICKNESS_Multiple_Comparisons_Focused_on_Euler)[names(THICKNESS_Multiple_Comparisons_Focused_on_Euler)=="value"] <- "Survives_Multiple_Comparison_Correction"
dk_statistical_values_THICKNESS_T_Focused_on_Euler_w_MultipleComparisons <- cbind(dk_statistical_values_THICKNESS_T_Focused_on_Euler, THICKNESS_Multiple_Comparisons_Focused_on_Euler)
# We make 2 figures (but store them)
THICKNESS_p1_Focused_on_Euler<-ggseg(dk_statistical_values_THICKNESS_T_Focused_on_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=t),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75)) +theme(legend.position = "bottom")
## merging atlas and data by 'label'
THICKNESS_p2_Focused_on_Euler<-ggseg(dk_statistical_values_THICKNESS_T_Focused_on_Euler_w_MultipleComparisons,atlas=dk,position = "stacked",mapping=aes(fill=factor(Survives_Multiple_Comparison_Correction)),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
# Then output and combine in cowplot
plot_grid(THICKNESS_p1_Focused_on_Euler, THICKNESS_p2_Focused_on_Euler,labels = c('THICKNESS T-Statistics \nFocuing on Euler Number', 'Survives Multiple \n Comparison Correction'))
Table S4
dk_statistical_values_THICKNESS_T_p_Focused_on_Euler %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('THICKNESS Parcel' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| THICKNESS Parcel | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| lh_bankssts | 2.37654 | 0.01840 | 0.03475 |
| lh_caudalanteriorcingulate | -0.84474 | 0.39924 | 0.49361 |
| lh_caudalmiddlefrontal | 3.02992 | 0.00276 | 0.00695 |
| lh_cuneus | 1.57838 | 0.11602 | 0.18347 |
| lh_entorhinal | -0.40535 | 0.68564 | 0.71729 |
| lh_fusiform | 2.81541 | 0.00535 | 0.01212 |
| lh_inferiorparietal | 4.20530 | 0.00004 | 0.00032 |
| lh_inferiortemporal | 4.63044 | 0.00001 | 0.00006 |
| lh_isthmuscingulate | 4.01491 | 0.00008 | 0.00047 |
| lh_lateraloccipital | 1.47702 | 0.14121 | 0.21720 |
| lh_lateralorbitofrontal | 5.24631 | 0.00000 | 0.00001 |
| lh_lingual | 3.56295 | 0.00046 | 0.00163 |
| lh_medialorbitofrontal | 3.18306 | 0.00168 | 0.00440 |
| lh_middletemporal | 0.94158 | 0.34752 | 0.45445 |
| lh_parahippocampal | 0.76034 | 0.44792 | 0.53436 |
| lh_paracentral | 2.15333 | 0.03246 | 0.05660 |
| lh_parsopercularis | 3.77828 | 0.00021 | 0.00101 |
| lh_parsorbitalis | 3.64742 | 0.00034 | 0.00137 |
| lh_parstriangularis | 3.34206 | 0.00099 | 0.00329 |
| lh_pericalcarine | 1.04951 | 0.29518 | 0.39357 |
| lh_postcentral | 0.49467 | 0.62137 | 0.68150 |
| lh_posteriorcingulate | 2.32413 | 0.02110 | 0.03877 |
| lh_precentral | 1.21430 | 0.22603 | 0.31368 |
| lh_precuneus | 2.88308 | 0.00436 | 0.01022 |
| lh_rostralanteriorcingulate | 0.47898 | 0.63247 | 0.68266 |
| lh_rostralmiddlefrontal | 5.07526 | 0.00000 | 0.00001 |
| lh_superiorfrontal | 4.18627 | 0.00004 | 0.00032 |
| lh_superiorparietal | 3.23275 | 0.00143 | 0.00405 |
| lh_superiortemporal | 0.42532 | 0.67105 | 0.71299 |
| lh_supramarginal | 1.10618 | 0.26994 | 0.36712 |
| lh_frontalpole | 3.21841 | 0.00150 | 0.00408 |
| lh_temporalpole | 0.67954 | 0.49756 | 0.57346 |
| lh_transversetemporal | 0.27212 | 0.78581 | 0.79753 |
| lh_insula | 0.33953 | 0.73456 | 0.75681 |
| rh_bankssts | 3.75278 | 0.00023 | 0.00103 |
| rh_caudalanteriorcingulate | 0.65225 | 0.51497 | 0.58363 |
| rh_caudalmiddlefrontal | 2.90901 | 0.00403 | 0.00978 |
| rh_cuneus | 2.04741 | 0.04189 | 0.06948 |
| rh_entorhinal | -1.42204 | 0.15653 | 0.22647 |
| rh_fusiform | 2.29842 | 0.02255 | 0.04035 |
| rh_inferiorparietal | 2.45495 | 0.01492 | 0.02985 |
| rh_inferiortemporal | 3.79723 | 0.00019 | 0.00101 |
| rh_isthmuscingulate | 1.39362 | 0.16494 | 0.23367 |
| rh_lateraloccipital | 2.50033 | 0.01319 | 0.02782 |
| rh_lateralorbitofrontal | 4.12569 | 0.00005 | 0.00034 |
| rh_lingual | 2.50130 | 0.01316 | 0.02782 |
| rh_medialorbitofrontal | 5.84649 | 0.00000 | 0.00000 |
| rh_middletemporal | 1.59424 | 0.11242 | 0.18202 |
| rh_parahippocampal | 0.14090 | 0.88809 | 0.88809 |
| rh_paracentral | 3.27744 | 0.00123 | 0.00380 |
| rh_parsopercularis | 3.23617 | 0.00141 | 0.00405 |
| rh_parsorbitalis | 5.66699 | 0.00000 | 0.00000 |
| rh_parstriangularis | 4.86709 | 0.00000 | 0.00003 |
| rh_pericalcarine | 2.09053 | 0.03780 | 0.06426 |
| rh_postcentral | 0.79407 | 0.42807 | 0.51980 |
| rh_posteriorcingulate | 3.58013 | 0.00043 | 0.00162 |
| rh_precentral | 1.42854 | 0.15466 | 0.22647 |
| rh_precuneus | 3.33381 | 0.00102 | 0.00329 |
| rh_rostralanteriorcingulate | 1.46763 | 0.14374 | 0.21720 |
| rh_rostralmiddlefrontal | 5.35104 | 0.00000 | 0.00001 |
| rh_superiorfrontal | 4.11881 | 0.00006 | 0.00034 |
| rh_superiorparietal | 3.64146 | 0.00034 | 0.00137 |
| rh_superiortemporal | 0.84623 | 0.39841 | 0.49361 |
| rh_supramarginal | 2.49179 | 0.01350 | 0.02782 |
| rh_frontalpole | 2.42514 | 0.01617 | 0.03141 |
| rh_temporalpole | -0.68247 | 0.49571 | 0.57346 |
| rh_transversetemporal | 0.87921 | 0.38032 | 0.48796 |
| rh_insula | 0.56753 | 0.57098 | 0.63650 |
Descriptive Statistics about t-values for Thickness
And MRI Quality (controlling for Euler number)
range(dk_statistical_values_THICKNESS_T_p_Focused_on_Euler$t)
## [1] -1.422043 5.846493
mean(dk_statistical_values_THICKNESS_T_p_Focused_on_Euler$t)
## [1] 2.359513
sd(dk_statistical_values_THICKNESS_T_p_Focused_on_Euler$t)
## [1] 1.682148
table(dk_statistical_values_THICKNESS_T_p_Focused_on_Euler$p>.05)
##
## FALSE TRUE
## 41 27
table(is.na(THICKNESS_Multiple_Comparisons_Focused_on_Euler))
##
## FALSE TRUE
## 38 30
Final set of loops and data organization
This final time for the subcortical volumes
[ Same tibbling and regression loops, etc.]
Figure S10
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC[,14:58]
OnlySubsPassingVisualQC_Freesurfer_ASEG<-OnlySubsPassingVisualQC_Freesurfer_ASEG %>% dplyr::select(-c(Left.Cerebellum.White.Matter, Left.Cerebellum.Cortex, Left.Lateral.Ventricle,Left.Inf.Lat.Vent,X3rd.Ventricle,X4th.Ventricle,CSF,Left.vessel,Left.choroid.plexus,Right.Cerebellum.White.Matter,Right.Cerebellum.Cortex,Right.Lateral.Ventricle,Right.Inf.Lat.Vent,Right.vessel,Right.choroid.plexus,X5th.Ventricle,WM.hypointensities,Left.WM.hypointensities,Right.WM.hypointensities,non.WM.hypointensities,Left.non.WM.hypointensities,Right.non.WM.hypointensities,Optic.Chiasm))
CAT12Ratings<-OnlySubsPassingVisualQC$CAT12_QC_Weighted_Average
Euler<-OnlySubsPassingVisualQC$SurfaceHoles
## Regression Loop, with Aseg as DV and Age & QC as IVs
n<-22
ASEG_Loop_to_Extract_Tstats_Focused_on_Euler <- lapply(1:n, function(x) lm(OnlySubsPassingVisualQC_Freesurfer_ASEG[,x] ~ Euler + CAT12Ratings))
## Pull out T-Statistics from Regressions
ASEG_summaries_Focused_on_Euler <- lapply(ASEG_Loop_to_Extract_Tstats_Focused_on_Euler, summary)
ASEG_saved_T_Focused_on_Euler<-lapply(ASEG_summaries_Focused_on_Euler, function(x) x$coefficients[, c(3)])
ASEG_T_Statistics_temp_Focused_on_Euler<-lapply(ASEG_saved_T_Focused_on_Euler, function (x) x[c('Euler')])
ASEG_just_T_Statistics_Focused_on_Euler<-do.call(rbind.data.frame, ASEG_T_Statistics_temp_Focused_on_Euler)
names(ASEG_just_T_Statistics_Focused_on_Euler)[names(ASEG_just_T_Statistics_Focused_on_Euler)=="c..0.877419277757954..0.210596911938301...0.445240431045943.."] <- "T_stat"
## Rename and Reorder the data frames (related to t-statistics)
ASEG_just_T_Statistics_Focused_on_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_T_Statistics_Focused_on_Euler<-ASEG_just_T_Statistics_Focused_on_Euler[, c(2,1)]
## Pull out P-Values from Regressions
ASEG_saved_p_Focused_on_Euler<-lapply(ASEG_summaries_Focused_on_Euler, function(x) x$coefficients[, c(4)])
ASEG_p_Statistics_temp_Focused_on_Euler<-lapply(ASEG_saved_p_Focused_on_Euler, function (x) x[c('Euler')])
ASEG_just_p_Statistics_Focused_on_Euler<-do.call(rbind.data.frame, ASEG_p_Statistics_temp_Focused_on_Euler)
names(ASEG_just_p_Statistics_Focused_on_Euler)[names(ASEG_just_p_Statistics_Focused_on_Euler)=="c.0.381286059147978..0.833411001589855..0.656615800679571..0.228590975783425.."] <- "pvalue"
## Rename and Reorder the data frames (related to p-values)
ASEG_just_p_Statistics_Focused_on_Euler$BrainRegions<-(colnames(OnlySubsPassingVisualQC_Freesurfer_ASEG)[1:22])
ASEG_just_p_Statistics_Focused_on_Euler<-ASEG_just_p_Statistics_Focused_on_Euler[, c(2,1)]
# Make tibble to eventually put into ggseg [for t-statistics]
aseg_statistical_values_T_Focused_on_Euler= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
t=c(ASEG_just_T_Statistics_Focused_on_Euler$T_stat[1],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[2],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[3],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[4],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[5],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[6],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[7],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[8],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[9],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[10],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[11],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[12],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[13],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[14],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[15],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[16],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[17],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[18],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[19],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[20],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[21],
ASEG_just_T_Statistics_Focused_on_Euler$T_stat[22]))
# Make tibble to eventually put into ggseg [for p-values]
aseg_statistical_values_p_Focused_on_Euler= tibble(
label=c("Left-Thalamus-Proper",
"Left-Caudate",
"Left-Putamen",
"Left-Pallidum",
"brain-stem",
"Left-Hippocampus",
"Left-Amygdala",
"Left-Accumbens-area",
"Left-VentralDC",
"Right-Thalamus-Proper",
"Right-Caudate",
"Right-Putamen",
"Right-Pallidum",
"Right-Hippocampus",
"Right-Amygdala",
"Right-Accumbens-area",
"Right-VentralDC",
"cc-posterior",
"cc-mid-posterior",
"cc-central",
"cc-mid-anterior",
"cc-anterior"),
p=c(ASEG_just_p_Statistics_Focused_on_Euler$pvalue[1],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[2],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[3],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[4],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[5],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[6],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[7],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[8],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[9],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[10],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[11],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[12],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[13],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[14],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[15],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[16],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[17],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[18],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[19],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[20],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[21],
ASEG_just_p_Statistics_Focused_on_Euler$pvalue[22]))
# Multiple Comparison Correction
aseg_statistical_values_p_Focused_on_Euler$p_adjusted<-p.adjust(aseg_statistical_values_p_Focused_on_Euler$p, method = "BH", n = length(aseg_statistical_values_p_Focused_on_Euler$p))
aseg_statistical_values_T_p_Focused_on_Euler <- aseg_statistical_values_T_Focused_on_Euler %>% left_join(aseg_statistical_values_p_Focused_on_Euler)
## Joining, by = "label"
Aseg_Multiple_Comparisons_Focused_on_Euler<-as_tibble(as.numeric(aseg_statistical_values_T_p_Focused_on_Euler$p_adjusted<.05))
Aseg_Multiple_Comparisons_Focused_on_Euler$value<-car::recode(Aseg_Multiple_Comparisons_Focused_on_Euler$value, "0=NA")
names(Aseg_Multiple_Comparisons_Focused_on_Euler)[names(Aseg_Multiple_Comparisons_Focused_on_Euler)=="value"] <- "Survives_Multiple_Comparison_Correction"
aseg_statistical_values_T_w_MultipleComparisons_Focused_on_Euler <- cbind(aseg_statistical_values_T_Focused_on_Euler, Aseg_Multiple_Comparisons_Focused_on_Euler)
aseg_p1_Focused_on_Euler<-ggseg(aseg_statistical_values_T_Focused_on_Euler,atlas=aseg,position = "stacked",mapping=aes(fill=t,color=Survives_Multiple_Comparison_Correction),colour="black") + scale_fill_gradient2(low = "#045a8d",high = "#de2d26",space = "Lab",limits = c(-6.75, 6.75))+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbens-area 0.285
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumbens-area 0.837
aseg_p2_Focused_on_Euler<-ggseg(aseg_statistical_values_T_w_MultipleComparisons_Focused_on_Euler,atlas=aseg,position = "stacked",mapping=aes(fill=Survives_Multiple_Comparison_Correction),color="black")+theme(legend.position = "bottom")
## merging atlas and data by 'label'
## Warning: Some data not merged properly. Check for naming errors in data:
## atlas type hemi side region label t Survives_Multiple_Comparis…
## <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
## 1 <NA> <NA> <NA> <NA> <NA> Left-Accumbe… 0.285 NA
## 2 <NA> <NA> <NA> <NA> <NA> Right-Accumb… 0.837 NA
plot_grid(aseg_p1_Focused_on_Euler, aseg_p2_Focused_on_Euler,labels = c('Subcortical Volumes T-Statistics \nFocused on Euler Number', 'Survives Multiple \n Comparison Correction'))
plot_grid(aseg_p1_Focused_on_Euler, aseg_p2_Focused_on_Euler)
Again, we also output a Table showing the stats for
QC and aseg volumes
with adjusted and unadjusted p-values
For the folks who like tables, etc.
Table 4
aseg_statistical_values_T_p_Focused_on_Euler %>% mutate_if(is.numeric, round, 5) %>% rename('t_statistics' = 't') %>% rename('p_value' = 'p') %>% rename('Aseg_Volume' = 'label') %>% gt() %>% tab_style(style = cell_fill(color = "#fc9272"),locations = cells_body(columns = "p_adjusted", rows = (p_adjusted<.05))) %>% tab_style(style = cell_fill(color = "#fee0d2"),locations = cells_body(columns = "p_value", rows = (p_value<.05))) %>% tab_options(table.font.size = "smaller",column_labels.font.size = "small",data_row.padding = px(1))
| Aseg_Volume | t_statistics | p_value | p_adjusted |
|---|---|---|---|
| Left-Thalamus-Proper | -0.87742 | 0.38129 | 0.80685 |
| Left-Caudate | 0.21060 | 0.83341 | 0.98555 |
| Left-Putamen | -0.44524 | 0.65662 | 0.98555 |
| Left-Pallidum | -1.20760 | 0.22859 | 0.76373 |
| brain-stem | -2.08108 | 0.03867 | 0.28809 |
| Left-Hippocampus | -0.09648 | 0.92323 | 0.98555 |
| Left-Amygdala | 0.37464 | 0.70832 | 0.98555 |
| Left-Accumbens-area | 0.28469 | 0.77617 | 0.98555 |
| Left-VentralDC | -1.64313 | 0.10189 | 0.56039 |
| Right-Thalamus-Proper | -0.35703 | 0.72143 | 0.98555 |
| Right-Caudate | -0.01813 | 0.98555 | 0.98555 |
| Right-Putamen | 0.05701 | 0.95460 | 0.98555 |
| Right-Pallidum | -0.60692 | 0.54458 | 0.98555 |
| Right-Hippocampus | 0.17504 | 0.86122 | 0.98555 |
| Right-Amygdala | 0.49468 | 0.62136 | 0.98555 |
| Right-Accumbens-area | 0.83726 | 0.40342 | 0.80685 |
| Right-VentralDC | -1.10141 | 0.27201 | 0.76373 |
| cc-posterior | -2.15993 | 0.03194 | 0.28809 |
| cc-mid-posterior | -0.91161 | 0.36305 | 0.80685 |
| cc-central | -2.07446 | 0.03928 | 0.28809 |
| cc-mid-anterior | -1.27159 | 0.20496 | 0.76373 |
| cc-anterior | -1.08835 | 0.27772 | 0.76373 |
range(aseg_statistical_values_T_p_Focused_on_Euler$t)
## [1] -2.1599324 0.8372575
mean(aseg_statistical_values_T_p_Focused_on_Euler$t)
## [1] -0.6139306
sd(aseg_statistical_values_T_p_Focused_on_Euler$t)
## [1] 0.892568
table(aseg_statistical_values_T_p_Focused_on_Euler$p>.05)
##
## FALSE TRUE
## 3 19
table(is.na(Aseg_Multiple_Comparisons_Focused_on_Euler))
##
## TRUE
## 22